fix(anilist): fixed some TypeErrors (#233)
* fix(anilist): forward-declare flushCoverSnapshot before first use * fix(anilist): split json.encode from writeFile call to avoid arg splat * chore(anilist): version bump
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
id = "cleboost/anilist"
|
id = "cleboost/anilist"
|
||||||
name = "AniList (UNOFFICIAL)"
|
name = "AniList (UNOFFICIAL)"
|
||||||
version = "1.1.1"
|
version = "1.1.2"
|
||||||
plugin_api = 15
|
plugin_api = 15
|
||||||
author = "Cleboost"
|
author = "Cleboost"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ local oauthStartedAt = 0
|
|||||||
|
|
||||||
local libraryFetch = nil
|
local libraryFetch = nil
|
||||||
local finalizeQueue = nil
|
local finalizeQueue = nil
|
||||||
|
local flushCoverSnapshot
|
||||||
local legacyCachePurged = false
|
local legacyCachePurged = false
|
||||||
local pendingLegacyPurge = false
|
local pendingLegacyPurge = false
|
||||||
|
|
||||||
@@ -317,10 +318,11 @@ local function writeCoverMeta(mediaId, url)
|
|||||||
if not metaPath then
|
if not metaPath then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
noctalia.writeFile(metaPath, noctalia.json.encode({
|
local payload = noctalia.json.encode({
|
||||||
url = url,
|
url = url,
|
||||||
version = COVER_CACHE_VERSION,
|
version = COVER_CACHE_VERSION,
|
||||||
}))
|
})
|
||||||
|
noctalia.writeFile(metaPath, payload)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function removeCoverCache(mediaId)
|
local function removeCoverCache(mediaId)
|
||||||
@@ -411,7 +413,7 @@ local function requestCoverSnapshot()
|
|||||||
pendingCoverSnapshot = true
|
pendingCoverSnapshot = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function flushCoverSnapshot()
|
function flushCoverSnapshot()
|
||||||
if pendingCoverSnapshot then
|
if pendingCoverSnapshot then
|
||||||
pendingCoverSnapshot = false
|
pendingCoverSnapshot = false
|
||||||
publishSnapshot()
|
publishSnapshot()
|
||||||
@@ -1289,10 +1291,11 @@ local function startOAuthLogin()
|
|||||||
local resultPath = dataDir .. "/" .. OAUTH_RESULT_FILE
|
local resultPath = dataDir .. "/" .. OAUTH_RESULT_FILE
|
||||||
noctalia.removeFile(resultPath)
|
noctalia.removeFile(resultPath)
|
||||||
|
|
||||||
local credOk = noctalia.writeFile(credPath, noctalia.json.encode({
|
local credPayload = noctalia.json.encode({
|
||||||
client_id = clientId,
|
client_id = clientId,
|
||||||
client_secret = clientSecret,
|
client_secret = clientSecret,
|
||||||
}))
|
})
|
||||||
|
local credOk = noctalia.writeFile(credPath, credPayload)
|
||||||
if not credOk then
|
if not credOk then
|
||||||
setError(tr("oauth_unavailable"))
|
setError(tr("oauth_unavailable"))
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user