Skip to content

Commit

Permalink
Fix handling of accents in map file name, fix handling of bad cached
Browse files Browse the repository at this point in the history
modules
  • Loading branch information
rrgeorge committed Jul 21, 2022
1 parent 4379d04 commit ed33311
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
13 changes: 10 additions & 3 deletions ddb.js
Original file line number Diff line number Diff line change
Expand Up @@ -1487,13 +1487,18 @@ ${(monster.sourceId)?`<i>Source: ${this.ruledata.sources.find((s)=> monster.sour
manifestVersion = parseInt(manifest.readAsText("version.txt").trim())
}
let modVersion = 0
let bookkey = null
let modCache = new AdmZip(path.join(app.getPath("cache"),app.getName(),"imagecache",`${book.name.toLowerCase()}.zip`))
modVersion = parseInt(modCache.readAsText("version.txt").trim())
const bookkey = modCache.getZipEntryComment(`${book.name.toLowerCase()}.db3`)
try {
bookkey = modCache.getZipEntryComment(`${book.name.toLowerCase()}.db3`)
modVersion = parseInt(modCache.readAsText("version.txt").trim())
} catch (e) {
console.log(`Error getting module version ${e}`)
}
let modsObj = {}
modsObj[moduleId.toString()] = modVersion
const manifest = await this.checkManifestVersion(manifestVersion,modsObj)
if (manifest?.data?.sourceUpdatesAvailable?.[moduleId.toString()] !== true) {
if (bookkey && manifest?.data?.sourceUpdatesAvailable?.[moduleId.toString()] !== true) {
console.log("Using cached Module")
prog = new ProgressBar({
title: "Converting module...",
Expand Down Expand Up @@ -2916,6 +2921,8 @@ function doSearch(el,resId) {
dmMap = figure.querySelector("img").getAttribute('src')
mapUrl = caption.querySelector("A")?.getAttribute('href') || dmMap;
}
dmMap = encodeURI(dmMap)
mapUrl = encodeURI(mapUrl)
if (!mapTitle) {
let figParent = figure
while(figParent = figParent.parentElement) {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "encounterlog",
"productName": "EncounterLog",
"version": "2.6.6",
"version": "2.6.7",
"repository": {
"type": "git",
"url": "https://github.com/rrgeorge/encounterlog"
Expand Down Expand Up @@ -159,7 +159,7 @@
"dependencies": {
"@google-cloud/vision": "^2.3.8",
"@journeyapps/sqlcipher": "^5.3.1",
"adm-zip": "^0.5.5",
"adm-zip": "^0.5.9",
"build": "^0.1.4",
"electron-dl": "^3.2.1",
"electron-preferences": "^2.3.1",
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ __metadata:
languageName: node
linkType: hard

"adm-zip@npm:^0.5.5":
"adm-zip@npm:^0.5.9":
version: 0.5.9
resolution: "adm-zip@npm:0.5.9"
checksum: 4909bc04119fdd5e8f8ba43826e50623e5c427cf0a939c809d4f9456a6a03c6aa0544e82088739de9ba16b7649f71b99ccbbddc7b2c38bd6143f9c4726cc7ed9
Expand Down Expand Up @@ -1980,7 +1980,7 @@ __metadata:
"@electron/universal": ^1.2.1
"@google-cloud/vision": ^2.3.8
"@journeyapps/sqlcipher": ^5.3.1
adm-zip: ^0.5.5
adm-zip: ^0.5.9
build: ^0.1.4
electron: ^18.0.3
electron-builder: ^23.0.3
Expand Down

0 comments on commit ed33311

Please sign in to comment.