Skip to content

Commit 888d9ba

Browse files
committed
New: Show package versions in About OpenComic
1 parent 1042797 commit 888d9ba

5 files changed

Lines changed: 73 additions & 68 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2020
- Copy image to clipboard [`bb96cef`](https://github.com/ollm/OpenComic/commit/bb96cef97ee1783fc27f3600548a91bb37a96045)
2121
- OPDS support [`b72f32f`](https://github.com/ollm/OpenComic/commit/b72f32f2445b90f13f5e2cc45865c2c17a72af82)
2222
- Button to enable/disable full screen from the more options menu [`5d2ac36`](https://github.com/ollm/OpenComic/commit/5d2ac367c61da97d04cd67526470fb7885c1b3bf)
23+
- Show package versions in About OpenComic
2324

2425
##### 🐛 Bug Fixes
2526

package-lock.json

Lines changed: 0 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@
105105
"shosho": "^1.4.3",
106106
"ssh2-sftp-client": "github:theophilusx/ssh2-sftp-client",
107107
"tar-fs": "^3.0.8",
108-
"unzipper": "^0.12.3",
109108
"webdav": "^5.7.1"
110109
},
111110
"devDependencies": {

scripts/opencomic.js

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,15 +1029,13 @@ function generateAppMenu(force = false)
10291029
}
10301030
}
10311031

1032-
var about = false;
1033-
10341032
function showAboutWindow()
10351033
{
1036-
var about = new electronRemote.BrowserWindow({
1034+
const about = new electronRemote.BrowserWindow({
10371035
show: false,
10381036
title: language.menu.help.about,
1039-
width: 460,
1040-
height: 320,
1037+
width: 900,
1038+
height: 600,
10411039
minWidth: 380,
10421040
minHeight: 260,
10431041
//resizable: false,
@@ -1050,10 +1048,39 @@ function showAboutWindow()
10501048
},
10511049
});
10521050

1051+
const packageLock = JSON.parse(readFileApp('package-lock.json'));
1052+
const highlight = [
1053+
'electron',
1054+
'sharp',
1055+
'pdfjs-dist',
1056+
];
1057+
1058+
const allDependencies = {..._package.dependencies, ..._package.devDependencies};
1059+
const dependencies = [];
1060+
1061+
for(let key in allDependencies)
1062+
{
1063+
allDependencies[key] = packageLock.packages[key]?.version ?? packageLock.packages['node_modules/'+key]?.version ?? allDependencies[key];
1064+
1065+
if(!highlight.includes(key))
1066+
dependencies.push({package: key, version: allDependencies[key]});
1067+
}
1068+
1069+
const highlightDependencies = [];
1070+
1071+
for(let i = 0, len = highlight.length; i < len; i++)
1072+
{
1073+
const key = highlight[i];
1074+
highlightDependencies.push({package: key, version: allDependencies[key]});
1075+
}
1076+
1077+
handlebarsContext.highlightDependencies = highlightDependencies;
1078+
handlebarsContext.dependencies = dependencies;
1079+
10531080
about.removeMenu();
10541081
about.setMenuBarVisibility(false);
10551082

1056-
var url = require('url');
1083+
const url = require('url');
10571084

10581085
about.loadURL(url.format({
10591086
pathname: p.join(appDir, './templates/about.html'),

templates/about.body.html

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,28 @@
8787
line-height: 20px;
8888
}
8989

90+
.about-packages
91+
{
92+
max-width: 800px;
93+
line-height: 24px;
94+
}
95+
96+
.about-packages > div
97+
{
98+
height: 20px;
99+
}
100+
101+
.about-packages > span
102+
{
103+
margin: 0px 4px;
104+
white-space: nowrap;
105+
}
106+
107+
.about-packages > span span
108+
{
109+
opacity: 0.6;
110+
}
111+
90112
.night-mode
91113
{
92114
background-color: #242a30;
@@ -107,6 +129,11 @@
107129
color: rgba(255, 255, 255, 1);
108130
}
109131

132+
.night-mode .about-packages
133+
{
134+
color: rgba(255, 255, 255, 1);
135+
}
136+
110137
a
111138
{
112139
color: #1976D2 !important;
@@ -142,6 +169,18 @@
142169
{{#each language.about.translators}}{{#unless @first}}{{#if @last}} {{@root.language.global.and}} {{else}}, {{/if}}{{/unless}}
143170
<a href="javascript:void(0);" onclick="shell.openExternal('{{#if url}}{{url}}{{else}}mailto:{{email}}{{/if}}')">{{name}}</a>
144171
{{/each}}
172+
<br>
173+
</div>
174+
<br><br>
175+
<div class="about-packages">
176+
{{#each highlightDependencies}}
177+
<span><a href="javascript:void(0);" onclick="shell.openExternal('https://www.npmjs.com/package/{{package}}')">{{package}}</a> <span>v{{version}}</span></span>
178+
{{/each}}
179+
<div></div>
180+
{{#each dependencies}}
181+
<span><a href="javascript:void(0);" onclick="shell.openExternal('https://www.npmjs.com/package/{{package}}')">{{package}}</a> <span>v{{version}}</span></span>
182+
{{/each}}
183+
<br><br>
145184
</div>
146185
</div>
147186
</div>

0 commit comments

Comments
 (0)