Skip to content

Commit

Permalink
bump api version to 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwynr committed May 4, 2023
1 parent bcfc5b3 commit 5714a80
Show file tree
Hide file tree
Showing 9 changed files with 411 additions and 484 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "filen-desktop",
"author": "Filen Cloud Dienste UG (haftungsbeschränkt) <support@filen.io>",
"description": "Filen Desktop Client",
"version": "2.0.17",
"version": "2.0.20",
"private": true,
"engines": {
"node": "14.x"
Expand Down
214 changes: 100 additions & 114 deletions src/constants.json
Original file line number Diff line number Diff line change
@@ -1,115 +1,101 @@
{
"apiServers": [
"api.filen.io"
],
"uploadServers": [
"up.filen.io"
],
"downloadServers": [
"down.filen.io"
],
"chunkSize": 1048576,
"maxConcurrentUploads": 8,
"maxConcurrentDownloads": 10,
"maxDownloadThreads": 128,
"maxUploadThreads": 10,
"maxConcurrentTransfers": 20,
"maxRetryAPIRequest": 32,
"retryAPIRequestTimeout": 1000,
"maxRetrySyncTask": 8,
"retrySyncTaskTimeout": 1000,
"maxRetryUpload": 8,
"retryUploadTimeout": 1000,
"maxRetryDownload": 8,
"retryDownloadTimeout": 1000,
"sizeOverheadMultiplier": 1,
"speedMultiplier": 1,
"maxConcurrentSyncTasks": 128,
"maxConcurrentAPIRequest": 128,
"clearLocalTrashDirsInterval": 900000,
"deleteFromLocalTrashAfter": 2592000000,
"defaultIgnored": {
"names": [
".ds_store",
"desktop.ini",
"thumbs.db",
"ntuser.dat",
"AUX",
"PRN",
"NUL",
"CON",
"LPT1",
"LPT2",
"LPT3",
"LPT4",
"LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9",
"COM1",
"COM2",
"COM3",
"COM4",
"COM5",
"COM6",
"COM7",
"COM8",
"COM9"
],
"extensions": [
"tmp",
"temp",
"ffs_tmp",
"temporary",
"crdownload",
"~cr",
"thumbdata"
],
"folders": [
".filen.trash.local",
"$RECYCLE.BIN",
".Trash",
".local/share/Trash",
"/share/Trash",
"local/share/Trash",
"/AppData/Local",
"/AppData/Roaming"
],
"system": [
"//C:\\$WINDOWS.~BT",
"//C:\\$Windows.~WS",
"//C:\\$WinREAgent",
"//C:\\Windows",
"//C:\\OneDriveTemp",
"//C:\\PerfLogs",
"//C:\\ProgramData",
"//C:\\Program Files\\Uninstall Information",
"//C:\\Program Files\\WindowsApps",
"//C:\\Program Files\\Windows Defender",
"//C:\\Program Files\\Windows Mail",
"//C:\\Program Files\\Windows Media Player",
"//C:\\Program Files\\Windows Multimedia Platform",
"//C:\\Program Files\\Windows NT",
"//C:\\Program Files\\Windows Photo Viewer",
"//C:\\Program Files\\Windows Portable Devices",
"//C:\\Program Files\\Windows Security",
"//C:\\Program Files\\WindowsPowerShell",
"//C:\\Program Files (x86)\\Uninstall Information",
"//C:\\Program Files (x86)\\WindowsApps",
"//C:\\Program Files (x86)\\Windows Defender",
"//C:\\Program Files (x86)\\Windows Mail",
"//C:\\Program Files (x86)\\Windows Media Player",
"//C:\\Program Files (x86)\\Windows Multimedia Platform",
"//C:\\Program Files (x86)\\Windows NT",
"//C:\\Program Files (x86)\\Windows Photo Viewer",
"//C:\\Program Files (x86)\\Windows Portable Devices",
"//C:\\Program Files (x86)\\Windows Security",
"//C:\\Program Files (x86)\\WindowsPowerShell",
"//C:\\Program Files (x86)\\Internet Explorer",
"//C:\\Program Files (x86)\\Microsoft",
"//C:\\Program Files (x86)\\WindowsPowerShell",
"//C:\\Program Files (x86)\\Reference Assemblies"
]
}
}
"apiServers": ["gateway.filen.io"],
"uploadServers": ["ingest.filen.io"],
"downloadServers": ["down.filen.io"],
"chunkSize": 1048576,
"maxConcurrentUploads": 8,
"maxConcurrentDownloads": 10,
"maxDownloadThreads": 128,
"maxUploadThreads": 10,
"maxConcurrentTransfers": 20,
"maxRetryAPIRequest": 32,
"retryAPIRequestTimeout": 1000,
"maxRetrySyncTask": 8,
"retrySyncTaskTimeout": 1000,
"maxRetryUpload": 8,
"retryUploadTimeout": 1000,
"maxRetryDownload": 8,
"retryDownloadTimeout": 1000,
"sizeOverheadMultiplier": 1,
"speedMultiplier": 1,
"maxConcurrentSyncTasks": 128,
"maxConcurrentAPIRequest": 128,
"clearLocalTrashDirsInterval": 900000,
"deleteFromLocalTrashAfter": 2592000000,
"defaultIgnored": {
"names": [
".ds_store",
"desktop.ini",
"thumbs.db",
"ntuser.dat",
"AUX",
"PRN",
"NUL",
"CON",
"LPT1",
"LPT2",
"LPT3",
"LPT4",
"LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9",
"COM1",
"COM2",
"COM3",
"COM4",
"COM5",
"COM6",
"COM7",
"COM8",
"COM9"
],
"extensions": ["tmp", "temp", "ffs_tmp", "temporary", "crdownload", "~cr", "thumbdata"],
"folders": [
".filen.trash.local",
"$RECYCLE.BIN",
".Trash",
".local/share/Trash",
"/share/Trash",
"local/share/Trash",
"/AppData/Local",
"/AppData/Roaming"
],
"system": [
"//C:\\$WINDOWS.~BT",
"//C:\\$Windows.~WS",
"//C:\\$WinREAgent",
"//C:\\Windows",
"//C:\\OneDriveTemp",
"//C:\\PerfLogs",
"//C:\\ProgramData",
"//C:\\Program Files\\Uninstall Information",
"//C:\\Program Files\\WindowsApps",
"//C:\\Program Files\\Windows Defender",
"//C:\\Program Files\\Windows Mail",
"//C:\\Program Files\\Windows Media Player",
"//C:\\Program Files\\Windows Multimedia Platform",
"//C:\\Program Files\\Windows NT",
"//C:\\Program Files\\Windows Photo Viewer",
"//C:\\Program Files\\Windows Portable Devices",
"//C:\\Program Files\\Windows Security",
"//C:\\Program Files\\WindowsPowerShell",
"//C:\\Program Files (x86)\\Uninstall Information",
"//C:\\Program Files (x86)\\WindowsApps",
"//C:\\Program Files (x86)\\Windows Defender",
"//C:\\Program Files (x86)\\Windows Mail",
"//C:\\Program Files (x86)\\Windows Media Player",
"//C:\\Program Files (x86)\\Windows Multimedia Platform",
"//C:\\Program Files (x86)\\Windows NT",
"//C:\\Program Files (x86)\\Windows Photo Viewer",
"//C:\\Program Files (x86)\\Windows Portable Devices",
"//C:\\Program Files (x86)\\Windows Security",
"//C:\\Program Files (x86)\\WindowsPowerShell",
"//C:\\Program Files (x86)\\Internet Explorer",
"//C:\\Program Files (x86)\\Microsoft",
"//C:\\Program Files (x86)\\WindowsPowerShell",
"//C:\\Program Files (x86)\\Reference Assemblies"
]
}
}
34 changes: 16 additions & 18 deletions src/main/lib/db/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,30 +25,28 @@ export const get = async (key: string) => {
const keyHash = hashKey(key)

try {
var data = await fs.readFile(pathModule.join(DB_PATH, keyHash + ".json"), "utf-8")
} catch (e) {
return null
}
const val = JSON.parse(await fs.readFile(pathModule.join(DB_PATH, keyHash + ".json"), "utf-8"))

const val = JSON.parse(data)
if (typeof val !== "object") {
return null
}

if (typeof val !== "object") {
return null
}
if (typeof val.key !== "string" || typeof val.value == "undefined") {
return null
}

if (typeof val.key !== "string" || typeof val.value == "undefined") {
return null
}
if (val.key !== key) {
return null
}

if (val.key !== key) {
return null
}
if (USE_MEMORY_CACHE) {
memoryCache.set(MEMORY_CACHE_KEY + key, val.value)
}

if (USE_MEMORY_CACHE) {
memoryCache.set(MEMORY_CACHE_KEY + key, val.value)
return val.value
} catch (e) {
return null
}

return val.value
}

export const set = (key: string, value: any) => {
Expand Down

0 comments on commit 5714a80

Please sign in to comment.