Skip to content

Commit e572128

Browse files
committed
New: Show release notes in new version dialog
1 parent 6fe5358 commit e572128

11 files changed

Lines changed: 111 additions & 61 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2929
- Change extraction of `RAR` and `TAR` to 7zip to improve performance [`c0c2d6d`](https://github.com/ollm/OpenComic/commit/c0c2d6d61016241e70d4ee475e8d19567b8e71db)
3030
- Add suport for compressed `LZH`, `ACE`, `TAR.GZ`, `TAR.XZ`, `TAR.BZIP2` and `TAR.ZSTD` [`e7e7815`](https://github.com/ollm/OpenComic/commit/e7e7815d7a841c02354f9b5219fcdf348c10543b)
3131
- Support compressed files with password [`9a6ef8e`](https://github.com/ollm/OpenComic/commit/9a6ef8e0a363e72e98634e827c50189bb2841047)
32+
- Show release notes in new version dialog
3233

3334
##### 🐛 Bug Fixes
3435

TRANSLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ Translate by [Nguyen Do](https://github.com/catouberos)
237237

238238
Translate by [無情天](https://github.com/kofzhanganguo)
239239

240-
`99.6% | Remain 2 | Translated 489`
240+
`100% | Remain 0 | Translated 491`
241241

242242
<a href="https://github.com/ollm/OpenComic/blob/master/languages/zh-hans.json"><img src="https://raw.githubusercontent.com/ollm/OpenComic/master/images/translated/zh-hans.svg" /></a>
243243

images/translated.svg

Lines changed: 1 addition & 1 deletion
Loading

images/translated/zh-hans.svg

Lines changed: 1 addition & 1 deletion
Loading

languages/zh-hans.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,4 +601,4 @@
601601
}
602602
]
603603
}
604-
}
604+
}

package-lock.json

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

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@
100100
"jquery-bez": "^1.0.11",
101101
"jxl-oxide-wasm": "^0.12.2",
102102
"lodash.isequal": "^4.5.0",
103+
"marked": "^15.0.12",
103104
"mime": "^4.0.7",
104105
"minimatch": "^10.0.1",
105106
"mv": "^2.1.1",
106107
"node-7z": "github:ollm/node-7z",
107108
"node-scp": "^0.0.25",
108109
"pdfjs-dist": "^5.2.133",
109110
"sanitize-html": "^2.17.0",
110-
"sharp": "^0.34.2-rc.0",
111+
"sharp": "^0.34.2",
111112
"short-windows-path": "^1.0.3",
112113
"shosho": "^1.4.3",
113114
"ssh2-sftp-client": "github:theophilusx/ssh2-sftp-client",

scripts/check-releases.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1+
const sanitizeHtml = require('sanitize-html'),
2+
marked = require('marked');
13

24
function showReleaseDialog(release)
35
{
46
release.releases_url = 'https://github.com/ollm/OpenComic?tab=readme-ov-file#download';
57
release.html_url = 'https://github.com/ollm/OpenComic/releases';
68

9+
const parsed = marked.parse(release.body).replace(/(\<a\s)\s*/ig, '$1 target="_blank"').replace(/\<h5\>/ig, '<h5 class="title-small">');
10+
11+
const releaseNotes = sanitizeHtml(parsed, {
12+
allowedClasses: {
13+
h5: ['title-small'],
14+
},
15+
allowedAttributes: {
16+
a: ['href', 'target', 'data-function'],
17+
},
18+
});
19+
720
events.dialog({
821
header: hb.compile(language.dialog.release.title)({releaseName: release.name}),
9-
width: 360,
22+
width: 'max-content',
1023
height: false,
11-
content: hb.compile(language.dialog.release.body)({linkStart: '<a href="javascript:void(0);" class="link" onclick="electron.shell.openExternal(\''+release.html_url+'\')">', linkEnd: '</a>'}),
24+
content: '<div class="release-notes">'+releaseNotes+'</div>',
1225
buttons: [
1326
{
1427
text: language.buttons.dismiss,

scripts/dom/file-info.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ function sanitizeHtml(string)
579579
i: ['material-icon'],
580580
},
581581
allowedAttributes: {
582-
'a': ['href', 'target', 'data-function'],
582+
a: ['href', 'target', 'data-function'],
583583
},
584584
});
585585
}

templates/dialog.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="dialog" style="width: {{dialog.width}}px;{{#if dialog.height}}height: {{dialog.height}}px;{{/if}}{{#if dialog.maxHeight}}max-height: {{dialog.maxHeight}}px;{{/if}}">
1+
<div class="dialog" style="width: {{#compare dialog.width '==' 'max-content'}}max-content{{else}}{{dialog.width}}px{{/compare}};{{#if dialog.height}}height: {{dialog.height}}px;{{/if}}{{#if dialog.maxHeight}}max-height: {{dialog.maxHeight}}px;{{/if}}">
22
<div class="dialog-content" style="{{#if dialog.overflowHidden}}overflow: hidden; scrollbar-gutter: auto;{{/if}}{{#if dialog.maxHeight}}height: {{dialog.maxHeight}}px;{{/if}}">
33
{{#if dialog.header}}
44
<div class="dialog-header headline-small">{{{dialog.header}}}</div>

0 commit comments

Comments
 (0)