mirror of
https://github.com/bookorbit/bookorbit.git
synced 2026-11-03 00:11:37 -06:00
fix(kobo): strip leading v from server version in koreader plugin
The KOReader plugin's update check response provides the server version, which already contains a leading "v". The update and plugin popups in the KOReader plugin format the version with an explicit "v" prefix, resulting in a "vv" typo (e.g. "vv1.2.0"). Strip the leading "v" from the server version in the updater script if present to ensure it is displayed with a single "v" prefix. Closes #644
This commit is contained in:
@@ -211,7 +211,7 @@ function UpdateCheck:doCheckForUpdate()
|
||||
end
|
||||
|
||||
function UpdateCheck:handleUpdateVersionResponse(body, interactive, prompt_allowed)
|
||||
local server_ver = body.serverVersion or "unknown"
|
||||
local server_ver = tostring(body.serverVersion or "unknown"):gsub("^v", "")
|
||||
local plugin_latest = body.pluginVersion
|
||||
self.settings.update_check_last_at = os.time()
|
||||
|
||||
|
||||
@@ -182,6 +182,14 @@ describe('KOReader plugin update source wiring', () => {
|
||||
expect(updater).toContain('self.settings.update_dismissed_version = plugin_latest');
|
||||
});
|
||||
|
||||
it('renders the server version with exactly one v prefix in update dialogs', async () => {
|
||||
const updater = await readPluginFile('bookorbit_updater.lua');
|
||||
|
||||
expect(updater).toContain('local server_ver = tostring(body.serverVersion or "unknown"):gsub("^v", "")');
|
||||
expect(updater).toContain('Plugin is up to date (v%1).\\nServer: v%2');
|
||||
expect(updater).toContain('Update available: v%1 -> v%2\\nServer: v%3');
|
||||
});
|
||||
|
||||
it('runs a throttled update check after successful full-library sweeps', async () => {
|
||||
const main = await readPluginFile('main.lua');
|
||||
const sweep = await readPluginFile('bookorbit_sweep.lua');
|
||||
|
||||
Reference in New Issue
Block a user