Skip to content

Commit

Permalink
Fixed #114
Browse files Browse the repository at this point in the history
  • Loading branch information
Creckeryop committed Feb 27, 2022
1 parent 5a91ee9 commit 99f0c34
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions source/assets/libs/settings.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Settings = {
Language = "Default",
Theme = "Light",
Version = 0.9,
Version = 0.91,
NSFW = false,
Orientation = "Horizontal",
ZoomReader = "Smart",
Expand Down Expand Up @@ -573,15 +573,19 @@ SettingsFunctions = {
OnComplete = function()
local content = file.string or ""
local link = content:match('href="([^"]-%.vpk)"')
local late = link:match("/([^/]-)/[^/]-%.vpk")
lastVpkLink = link
lastVpkSize = content:match('size%-label[^>]->([^<]-)<') or "NaN"
settings.LateVersion = late or settings.LateVersion
local body = content:match('markdown%-body[^>]-">(.-)</div>') or ""
changesText = body:gsub("\n+%s-(%S)", "\n%1"):gsub("<li>", " * "):gsub("<[^>]->", ""):gsub("\n\n", "\n"):gsub("^\n", ""):gsub("%s+$", "") or ""
if settings.LateVersion and settings.Version and tonumber(settings.LateVersion) > tonumber(settings.Version) then
Changes.load(Language[settings.Language].NOTIFICATIONS.NEW_UPDATE_AVAILABLE .. " : " .. settings.LateVersion .. "\n" .. Language[settings.Language].SETTINGS.CurrentVersionIs .. settings.Version .. "\n\n" .. changesText)
Notifications.push(Language[settings.Language].NOTIFICATIONS.NEW_UPDATE_AVAILABLE .. " " .. settings.LateVersion)
if link then
local late = link:match("/([^/]-)/[^/]-%.vpk")
if late then
lastVpkLink = link
lastVpkSize = content:match("size%-label[^>]->([^<]-)<") or "NaN"
settings.LateVersion = late or settings.LateVersion
local body = content:match('markdown%-body[^>]-">(.-)</div>') or ""
changesText = body:gsub("\n+%s-(%S)", "\n%1"):gsub("<li>", " * "):gsub("<[^>]->", ""):gsub("\n\n", "\n"):gsub("^\n", ""):gsub("%s+$", "") or ""
if settings.LateVersion and settings.Version and tonumber(settings.LateVersion) > tonumber(settings.Version) then
Changes.load(Language[settings.Language].NOTIFICATIONS.NEW_UPDATE_AVAILABLE .. " : " .. settings.LateVersion .. "\n" .. Language[settings.Language].SETTINGS.CurrentVersionIs .. settings.Version .. "\n\n" .. changesText)
Notifications.push(Language[settings.Language].NOTIFICATIONS.NEW_UPDATE_AVAILABLE .. " " .. settings.LateVersion)
end
end
end
end
}
Expand Down

0 comments on commit 99f0c34

Please sign in to comment.