Skip to content

Commit

Permalink
سكريبت بسيط للبحث عن اصدارات جديدة
Browse files Browse the repository at this point in the history
  • Loading branch information
kemzops committed Dec 30, 2022
1 parent 476aa11 commit 5999e0a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Window/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ module.exports = async function homeWindow(BrowserWindow, ipcMain, app, Tray, Me

createFile(path.join(app.getPath("appData"), './altaqwaa'));
await location(path.join(app?.getPath("appData"), './altaqwaa'));
let App_Path = path.join(app?.getPath("appData"), '/altaqwaa');

let win
let tray
let contextMenu
Expand Down Expand Up @@ -46,7 +48,6 @@ module.exports = async function homeWindow(BrowserWindow, ipcMain, app, Tray, Me
win?.on('closed', (event) => {

event?.preventDefault();
let App_Path = path.join(app?.getPath("appData"), '/altaqwaa');
let soundJson = fs.readJsonSync(path.join(App_Path, './data/sound.json'));
let audioJson = fs.readJsonSync(path.join(App_Path, './data/audio_window.json'));
audioJson.start = false
Expand Down Expand Up @@ -153,5 +154,6 @@ module.exports = async function homeWindow(BrowserWindow, ipcMain, app, Tray, Me
tray?.destroy();
});

fs.writeJsonSync(path.join(App_Path, './data/settings.json'), { currentRelease: app.getVersion() }, { spaces: '\t' });

}
3 changes: 2 additions & 1 deletion pages/info.html
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<li id="url_5">node-fetch</li>
<li id="url_6">request</li>
<li id="url_7">menubar</li>
<li id="url_8">v8-compile-cache</li>

</ul>

Expand Down Expand Up @@ -170,7 +171,7 @@
<p id="me">تطبيق إسلامي مفتوح المصدر يعمل على أنظمة التشغيل ويندوز ولينكس سهل الإستخدام و جامع للكثير من
الميزات التي يحتاجها المسلم في يومه.</p>
<img src="../public/icon/github.png" id="github">
<p id="Version">v2.0.1</p>
<p id="Version"></p>
</div>
</div>

Expand Down
26 changes: 24 additions & 2 deletions preload/info.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
const { shell } = require('electron');
const fetch = require('node-fetch');

module.exports = function info() {
module.exports = function info(currentRelease) {

if (document.getElementById('info')) {

/*
* SIMPLE GITHUB API CHECK FOR NEW RELEASES SCRIPT
* THE CURRENT RELEASE LOADS IN PRELOAD.JS FILE
* https://github.com/kemzops
*/
fetch(`https://api.github.com/repos/rn0x/Altaqwaa-Islamic-Desktop-Application/releases`)
.then(response => response.json())
.then(releases => {
const latestRelease = releases[0];
if(currentRelease != latestRelease.tag_name.substring(1)) {
document.getElementById("Version").innerHTML = "هنالك اصدار جديد من البرنامج\n" + `الإصدار الحالي: v${currentRelease}\n` + `الإصدار الأخير: ${latestRelease.tag_name}`;
} else {
document.getElementById("Version").innerHTML = "الإصدار: v" + currentRelease;
}
})
.catch(error => { /* SKIP ERRORS... SOMETIMES ITS RATE LIMIT FOR GITHUB API */ });

let github = document.getElementById('github');
let altaqwaa = document.getElementById('altaqwaa');
let Developer = document.getElementById('Developer');
Expand Down Expand Up @@ -121,7 +139,11 @@ module.exports = function info() {

url_7.addEventListener('click', e => {
shell.openExternal('https://github.com/maxogden/menubar')
});
});

url_8.addEventListener('click', e => {
shell.openExternal('https://github.com/zertosh/v8-compile-cache')
});
}

}
9 changes: 7 additions & 2 deletions preload/preload.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { ipcRenderer } = require('electron');
const fs = require('fs-extra');
const path = require('path');
const home = require('./home.js');
const barWindow = require('./barWindow.js');
const Quran = require('./quran.js');
Expand All @@ -15,11 +17,14 @@ const settings = require('./settings.js');
const info = require('./info.js');
const hisnmuslim = require('./hisnmuslim.js');


window.addEventListener('DOMContentLoaded', async (e) => {

e.preventDefault();
let App_Path = await ipcRenderer.invoke('App_Path');

let App_Path = await ipcRenderer.invoke('App_Path');
let currentRelease = fs.readJsonSync(path.join(App_Path, './data/settings.json')).currentRelease || "0.0.0";

barWindow();
home(App_Path);
Quran(App_Path);
Expand All @@ -33,7 +38,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
prayer();
prayer_time(App_Path);
settings(App_Path);
info();
info(currentRelease);
hisnmuslim();

});

0 comments on commit 5999e0a

Please sign in to comment.