Skip to content

Commit 5261719

Browse files
authored
Merge pull request #9 from kemzops/main
سكريبت بسيط للبحث عن اصدارات جديدة
2 parents 476aa11 + 5e3355e commit 5261719

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

Window/home.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ module.exports = async function homeWindow(BrowserWindow, ipcMain, app, Tray, Me
88

99
createFile(path.join(app.getPath("appData"), './altaqwaa'));
1010
await location(path.join(app?.getPath("appData"), './altaqwaa'));
11+
let App_Path = path.join(app?.getPath("appData"), '/altaqwaa');
12+
1113
let win
1214
let tray
1315
let contextMenu
@@ -46,7 +48,6 @@ module.exports = async function homeWindow(BrowserWindow, ipcMain, app, Tray, Me
4648
win?.on('closed', (event) => {
4749

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

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

157159
}

pages/info.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
<li id="url_5">node-fetch</li>
139139
<li id="url_6">request</li>
140140
<li id="url_7">menubar</li>
141+
<li id="url_8">v8-compile-cache</li>
141142

142143
</ul>
143144

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

preload/info.js

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
const { shell } = require('electron');
2+
const fetch = require('node-fetch');
23

3-
module.exports = function info() {
4+
module.exports = function info(currentRelease) {
45

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

8+
/*
9+
* SIMPLE GITHUB API CHECK FOR NEW RELEASES SCRIPT
10+
* THE CURRENT RELEASE LOADS IN PRELOAD.JS FILE
11+
* https://github.com/kemzops
12+
*/
13+
fetch(`https://api.github.com/repos/rn0x/Altaqwaa-Islamic-Desktop-Application/releases`)
14+
.then(response => response.json())
15+
.then(releases => {
16+
const latestRelease = releases[0];
17+
if(currentRelease != latestRelease.tag_name.substring(1)) {
18+
document.getElementById("Version").innerHTML = "هنالك اصدار جديد من البرنامج\n" + `الإصدار الحالي: v${currentRelease}\n` + `الإصدار الأخير: ${latestRelease.tag_name}`;
19+
} else {
20+
document.getElementById("Version").innerHTML = "الإصدار: v" + currentRelease;
21+
}
22+
})
23+
.catch(error => { /* SKIP ERRORS... SOMETIMES ITS RATE LIMIT FOR GITHUB API */ });
24+
725
let github = document.getElementById('github');
826
let altaqwaa = document.getElementById('altaqwaa');
927
let Developer = document.getElementById('Developer');
@@ -121,7 +139,11 @@ module.exports = function info() {
121139

122140
url_7.addEventListener('click', e => {
123141
shell.openExternal('https://github.com/maxogden/menubar')
124-
});
142+
});
143+
144+
url_8.addEventListener('click', e => {
145+
shell.openExternal('https://github.com/zertosh/v8-compile-cache')
146+
});
125147
}
126148

127149
}

preload/preload.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const { ipcRenderer } = require('electron');
2+
const fs = require('fs-extra');
3+
const path = require('path');
24
const home = require('./home.js');
35
const barWindow = require('./barWindow.js');
46
const Quran = require('./quran.js');
@@ -15,11 +17,14 @@ const settings = require('./settings.js');
1517
const info = require('./info.js');
1618
const hisnmuslim = require('./hisnmuslim.js');
1719

20+
1821
window.addEventListener('DOMContentLoaded', async (e) => {
1922

2023
e.preventDefault();
21-
let App_Path = await ipcRenderer.invoke('App_Path');
2224

25+
let App_Path = await ipcRenderer.invoke('App_Path');
26+
let currentRelease = fs.readJsonSync(path.join(App_Path, './data/version.json')).currentRelease || "0.0.0";
27+
2328
barWindow();
2429
home(App_Path);
2530
Quran(App_Path);
@@ -33,7 +38,7 @@ window.addEventListener('DOMContentLoaded', async (e) => {
3338
prayer();
3439
prayer_time(App_Path);
3540
settings(App_Path);
36-
info();
41+
info(currentRelease);
3742
hisnmuslim();
3843

3944
});

0 commit comments

Comments
 (0)