Skip to content

Commit

Permalink
New: Option to start OpenComic directly in last reading
Browse files Browse the repository at this point in the history
  • Loading branch information
ollm committed Oct 11, 2023
1 parent cf3de6e commit 00cb8c7
Show file tree
Hide file tree
Showing 19 changed files with 160 additions and 28 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
##### 🚀 New Features

- Option to open directly in continue reading instead of the file list [`78646fe`](https://github.com/ollm/OpenComic/commit/78646fe6f4a17be6fc9fd0c940fd97d438c812c1)
- Option to start reading in full screen
- Option to start reading in full screen [`cf3de6e`](https://github.com/ollm/OpenComic/commit/cf3de6ed737189b53474a30e277245b988ee5d99)
- Option to start OpenComic directly in last reading

##### 🐛 Bug Fixes

- Error opening some images [`8b97435`](https://github.com/ollm/OpenComic/commit/8b974356dfcbb7222bdef5ace604caeda93e4663)
- Wrong cache folder in windows causing some bugs [`8b97435`](https://github.com/ollm/OpenComic/commit/dd6facaf67343185fa06b2377fdc64e66ad9090d)
- Extract large RAR and ZIP files blocks the app for a while [`adbdced`](https://github.com/ollm/OpenComic/commit/adbdceda278e6184bc477581be9a25b8fc0f166b)
- RAR error on extract with files some special chars (Changed unrar to node-unrar-js)
- RAR error on extract with files some special chars (Changed unrar to node-unrar-js) [`694fe27`](https://github.com/ollm/OpenComic/commit/694fe274982c0a9ad2421c6b226abceae1602c3a)

## [v1.0.0-beta.3](https://github.com/ollm/OpenComic/releases/tag/v1.0.0-beta.3) (09-10-2023)

Expand Down
6 changes: 4 additions & 2 deletions languages/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "Mostrar la ruta completa a l'obrir els còmics de la biblioteca",
"showFullPathOpened": "Mostrar la ruta completa a l'obrir un arxiu o carpeta"
},
"others": {
"main": "Altres configuracions",
"startupBehavior": {
"main": "Comportament d'inici",
"startInFullScreen": "Inicia OpenComic a pantalla completa",
"startInContinueReading": "Iniciar directament a l'última lectura",
"startOnlyFromLibrary": "Només si l'última lectura és de la biblioteca.",
"startOnStartup": "Iniciar OpenComic a l'inici"
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
8 changes: 5 additions & 3 deletions languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"main": "Reading preferences",
"maxMargin": "Maximum horizontal and vertical margin",
"globalZoom": "Applies a global zoom instead of image by image (Only in vertical reading)",
"startReadingInFullScreen": "Empieza a leer en pantalla completa",
"startReadingInFullScreen": "Start reading in full screen",
"trackingAtTheEnd": "Tracking at the end of the chapter/volume"
},
"navigation": {
Expand All @@ -148,9 +148,11 @@
"showFullPathLibrary": "Show full path when opening library comics",
"showFullPathOpened": "Show full path when opening a file or folder"
},
"others": {
"main": "Others settings",
"startupBehavior": {
"main": "Startup behavior",
"startInFullScreen": "Start OpenComic in full screen",
"startInContinueReading": "Start directly in last reading",
"startOnlyFromLibrary": "Only if last reading is from the library",
"startOnStartup": "Start OpenComic on startup"
},
"releases": {
Expand Down
6 changes: 4 additions & 2 deletions languages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "Mostrar la ruta completa al abrir los comics de la biblioteca",
"showFullPathOpened": "Mostrar la ruta completa al abrir un archivo o carpeta"
},
"others": {
"main": "Otros ajustes",
"startupBehavior": {
"main": "Comportamiento de inicio",
"startInFullScreen": "Iniciar OpenComic en pantalla completa",
"startInContinueReading": "Iniciar directamente en la última lectura",
"startOnlyFromLibrary": "Sólo si la última lectura es de la biblioteca",
"startOnStartup": "Iniciar OpenComic al inicio"
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/vi.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/zh-hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
4 changes: 3 additions & 1 deletion languages/zh-hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@
"showFullPathLibrary": "",
"showFullPathOpened": ""
},
"others": {
"startupBehavior": {
"main": "",
"startInFullScreen": "",
"startInContinueReading": "",
"startOnlyFromLibrary": "",
"startOnStartup": ""
},
"releases": {
Expand Down
79 changes: 75 additions & 4 deletions scripts/opencomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ var compressedMime = {
'all': [
'application/zip',
'application/x-cbz',
'application/x-zip',
'applicatpdomion/x-zip',
'application/x-zip-compressed',
'application/rar',
'application/x-cbr',
Expand Down Expand Up @@ -266,7 +266,7 @@ window.onload = function() {

}

function startApp()
async function startApp()
{
if(config.checkReleases)
checkReleases.check();
Expand All @@ -277,9 +277,80 @@ function startApp()
template.loadGlobalElement('index.elements.menus.html', 'menus');

if(electronRemote.process.argv && electronRemote.process.argv[1] && !inArray(electronRemote.process.argv[1], ['--no-sandbox', 'scripts/main.js', '.']) && fs.existsSync(electronRemote.process.argv[1]))
{
openComic(electronRemote.process.argv[1], false);
}
else
dom.loadIndexPage(false);
{
let lastReading = false;

if(config.startInContinueReading)
{
let readingProgress = storage.get('readingProgress');
let highest = 0;

for(let key in readingProgress)
{
if(readingProgress[key].lastReading > highest)
{
lastReading = {
mainPath: key,
path: readingProgress[key].path,
};

highest = readingProgress[key].lastReading;
}
}

if(lastReading && config.startOnlyFromLibrary)
{
let mainPaths = {};

// Comics in master folders
let masterFolders = storage.get('masterFolders');

if(!isEmpty(masterFolders))
{
for(let key in masterFolders)
{
if(fs.existsSync(masterFolders[key]))
{
let file = fileManager.file(masterFolders[key]);
let files = await file.readDir();
file.destroy();

for(let i = 0, len = files.length; i < len; i++)
{
let folder = files[i];

if(folder.folder || folder.compressed)
mainPaths[folder.path] = true;
}
}
}
}

// Comics in library
let comicsStorage = storage.get('comics');

if(!isEmpty(comicsStorage))
{
for(let key in comicsStorage)
{
mainPaths[comicsStorage[key].path] = true;
}
}

if(!mainPaths[lastReading.mainPath])
lastReading = false;
}
}

if(lastReading && fs.existsSync(lastReading.mainPath))
dom.openComic(false, lastReading.path, lastReading.mainPath);
else
dom.loadIndexPage(false);
}

dragAndDrop.start();
dom.search.start();
Expand Down Expand Up @@ -914,7 +985,7 @@ function openComic(filePath, animation = true)
{
if(pathIsSupported(filePath))
{
var selectImage = false, path = false, mainPath = false;
let selectImage = false, path = false, mainPath = false;

if(fs.statSync(filePath).isDirectory())
{
Expand Down
14 changes: 14 additions & 0 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,18 @@ function setStartInFullScreen(value)
storage.updateVar('config', 'startInFullScreen', value);
}

function setStartInContinueReading(value)
{
storage.updateVar('config', 'startInContinueReading', value);

dom.query('.settings-start-only-from-library').class(!value, 'disable-pointer');
}

function setStartOnlyFromLibrary(value)
{
storage.updateVar('config', 'startOnlyFromLibrary', value);
}

function setStartOnStartup(value)
{
storage.updateVar('config', 'startOnStartup', value);
Expand Down Expand Up @@ -362,6 +374,8 @@ module.exports = {
setShowFullPathLibrary: setShowFullPathLibrary,
setShowFullPathOpened: setShowFullPathOpened,
setStartInFullScreen: setStartInFullScreen,
setStartInContinueReading: setStartInContinueReading,
setStartOnlyFromLibrary: setStartOnlyFromLibrary,
setStartOnStartup: setStartOnStartup,
setCheckReleases: setCheckReleases,
setCheckPreReleases: setCheckPreReleases,
Expand Down
4 changes: 3 additions & 1 deletion scripts/storage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var changes = 54; // Update this if readingPagesConfig is updated
var changes = 55; // Update this if readingPagesConfig is updated

var readingPagesConfig = {
readingConfigName: '',
Expand Down Expand Up @@ -84,6 +84,8 @@ var storageDefault = {
readingTrackingAtTheEnd: true,
controllerDeadZone: 0.06,
startInFullScreen: false,
startInContinueReading: false,
startOnlyFromLibrary: true,
startOnStartup: false,
ignoreSingleFoldersLibrary: true,
whenOpenFolderContinueReading: false,
Expand Down
Loading

0 comments on commit 00cb8c7

Please sign in to comment.