Skip to content

Commit

Permalink
Version 2.4.1
Browse files Browse the repository at this point in the history
+ better input error checking in the options
+ improved filename sanitizer
  • Loading branch information
Cortys committed Aug 4, 2021
1 parent ea7a50c commit 1465af7
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The default update server URL is: `https://raw.githubusercontent.com/Cortys/comi

### Why it's not on Chrome Store?

I am fairly certain comic platforms will, unfortunately, try to remove this extension from Chrome Store, because it goes around their DRM.
I am fairly certain that *certain comic platforms* will, unfortunately, try to remove this extension from Chrome Store, because it goes around their DRM.

How to use
-----
Expand Down
Binary file modified download.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions source/comicReader.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ getSettings(function() {
if(start) {
if(start.download) {
renderFaviconPercentage(0);

loadComic(function(err) {
port.send({
what: "message_to_opener",
Expand Down Expand Up @@ -116,8 +116,7 @@ function renderFaviconPercentage(perc) {
}

var canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'),
data;
ctx = canvas.getContext('2d');

canvas.width = canvas.height = 32;

Expand Down Expand Up @@ -541,7 +540,7 @@ function setupSelectors() { // run a DOM scan to analyse how the reader DOM tree
}

// download the opened comic. a callback and a step function can be used.
function loadComic(callback, step, metaData) {
function loadComic(callback, step, metaData) {
throttleBlocker();
addTopBar();
overlay.style.display = "block";
Expand Down
4 changes: 2 additions & 2 deletions source/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

"name": "Comic Backup",
"description": "Save your comics as standard CBZ files.",
"version": "2.4.0",
"minimum_chrome_version": "43",
"version": "2.4.1",
"minimum_chrome_version": "45",

"icons": {
"128": "logo128.png",
Expand Down
8 changes: 4 additions & 4 deletions source/options/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<script src="jquery-2.1.4.min.js"></script>
</head>
<body>
<a href="https://github.com/Cortys" target="_blank" id="credits">v2.4.0 by <b>Cortys</b></a>
<a href="https://github.com/Cortys" target="_blank" id="credits">v2.4.1 by <b>Cortys</b></a>
<h1><img src="[email protected]" alt="Comic Backup Settings"></h1>
<div id="content">
<h2>Backup behaviour</h2>
Expand Down Expand Up @@ -51,7 +51,7 @@ <h2>Backup behaviour</h2>
<div class="aligner">Download Directory:</div><div class="aligner r">
<input placeholder="" type="text" id="directory">
</div><br>
<p><i>Please note, because of limitations of the extensions API, this will be a subdirectory of the default downloads folder.</i></p>
<p><i>Please note, because of limitations of the extensions API, this will be a subdirectory of the default downloads folder. Absolute paths are forbidden.</i></p>
<div class="aligner">Favicon text color:</div><div class="aligner r"><select id="faviconColor">
<option value="0">Black (for light themes)</option>
<option value="1">White (for dark themes)</option>
Expand All @@ -64,9 +64,9 @@ <h2>Updates</h2>
<h2>I need help!</h2>
<section><b>How is "Scan" different from the official backup options?</b> When you backup a comic with this extension, it takes high quality screenshots from the web reader. Those are quite good but do not match the quality of the official downloads. You should use "Scan" if you want to have smaller files or a comic is not officially available for download.</section>
<section><b>The download never starts!</b> To use the extension make sure you disabled the <i>Prompt to continue</i> message in the settings of the web reader (click the gear to get there).</section>
<section><b>My backups stop randomly and/or have blank pages!</b> Network latencies and UI event handling delays in the reader are quite unpredictable and can cause blank pages or even stop your backups. To circumvent that, you should increase the <u>page swap interval</u>. It determines the shortest allowed interval between two page swaps.</section>
<section><b>My backups stop randomly and/or have blank pages!</b> Network latencies and UI event handling delays in the reader are quite unpredictable and can cause blank pages or even stop your backups. To circumvent that, you should increase the <u>page swap interval</u>. It determines the shortest allowed interval between two page swaps. <i>Default: 600 ms</i></section>
<div class="aligner">Min. page swap interval:</div><div class="aligner r"><input value="600" type="text" id="pageSwapDelay"> ms</div>
<section><b>Some pages are missing in my backups!</b> You might want to fiddle with the <u>page skip delay</u>. It determines how long to wait for a reaction to a page swap. If the reader did not show any reaction to a page swap for the given time, the backup will just continue with the next page. This option is essential for manga fixed format comics, that have to be backed up in dual-page-mode and thus do not rerender every second page.</section>
<section><b>Some pages are missing in my backups!</b> You might want to fiddle with the <u>page skip delay</u>. It determines how long to wait for a reaction to a page swap. If the reader did not show any reaction to a page swap for the given time, the backup will just continue with the next page. This option is essential for manga fixed format comics, that have to be backed up in dual-page-mode and thus do not rerender every second page. <i>Default: 1200 ms</i></section>
<div class="aligner">Page skip delay:</div><div class="aligner r"><input value="1200" type="text" id="pageSkipDelay"> ms</div><br>
<section><b>It still does not work!</b> Sometimes the code of the online reader is changed. If that happens you can force a new exploit scan and the plugin will try to detect a new way to backup your comics. In order to do that you will be asked to perform some actions the next time you open a comic.</section>
<div class="aligner">Force new exploit scan:</div><div class="aligner r"><select id="selectors" data-message="reload_page">
Expand Down
28 changes: 20 additions & 8 deletions source/options/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,34 @@ for(var i = 0; i < selects.length; i++)
e.addEventListener("change", function() {
var o = {},
message = e.getAttribute("data-message");
toastr.remove();
/*This function will create a toast message every time the user does an action in the field options. */
toastr.success("Changes saved.");
toastr.remove();

if(e.id === "updateServer")
o[e.id] = e.value.charAt(e.value.length - 1) === "/" ? e.value.substr(0, e.value.length - 1) : e.value;
else if(e.id === "directory")
o[e.id] = e.value.length > 1 && e.value.charAt(e.value.length - 1) !== "/" ? e.value + "/" : e.value;
else if(e.id === "directory") {
var ev = e.value;
if(ev.match(/^\.|^([A-Za-z]:)|^(\\|\/)/g) != null) {
toastr.error("Invalid download directory.");
return;
}
ev = ev.replace(/\\/g, "/");
o[e.id] = ev.length > 1 && ev.charAt(ev.length - 1) !== "/" ? ev + "/" : ev;
e.value = o[e.id];
}
else {
o[e.id] = +e.value;
if(!Number.isFinite(o[e.id]))
if(!Number.isFinite(o[e.id])) {
toastr.error("Invalid number.");
return;
}
if((e.id === "pageSwapDelay" || e.id === "pageSkipDelay") && o[e.id] < 0)
o[e.id] = 0;
e.value = o[e.id];
}

/*This function will create a toast message every time the user does an action in the field options. */
toastr.success("Changes saved.");

if(message)
chrome.runtime.sendMessage({
what: "controller_message",
Expand Down Expand Up @@ -58,10 +70,10 @@ for(var i = 0; i < selects.length; i++)
p.innerHTML = "<i>Currently using the exploit preset. This can become outdated if the reader is updated.</i>";
document.body.appendChild(p);
}

if(a.selectors == null)
e.value = 1;

f();
});
else if(e.id === "updateServer")
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
122
123

0 comments on commit 1465af7

Please sign in to comment.