Ensure device_id (#15151)
This commit is contained in:
1 parent
0402180684
commit
628ea23817
3 files changed
+7
-7
No files matched your search
@@ -4,7 +4,6 @@ local Notification = require("ui/widget/notification")
|
||||
local WidgetContainer = require("ui/widget/container/widgetcontainer")
|
||||
local lfs = require("libs/libkoreader-lfs")
|
||||
local logger = require("logger")
|
||||
local random = require("random")
|
||||
local _ = require("gettext")
|
||||
local T = require("ffi/util").template
|
||||
|
||||
@@ -263,7 +262,7 @@ function ReaderAnnotation:onExportAnnotations(on_closing)
|
||||
if do_export and self:hasAnnotations() then
|
||||
local file = self:getExportAnnotationsFilepath()
|
||||
local anno = LuaSettings:open(file)
|
||||
local device_id = G_reader_settings:readSetting("device_id", random.uuid())
|
||||
local device_id = G_reader_settings:readSetting("device_id")
|
||||
anno:saveSetting("device_id", device_id)
|
||||
anno:saveSetting("datetime", os.date("%Y-%m-%d %H:%M:%S"))
|
||||
anno:saveSetting("paging", self.ui.paging and true)
|
||||
|
||||
@@ -12,16 +12,11 @@ local UIManager = require("ui/uimanager")
|
||||
local WidgetContainer = require("ui/widget/container/widgetcontainer")
|
||||
local logger = require("logger")
|
||||
local md5 = require("ffi/sha2").md5
|
||||
local random = require("random")
|
||||
local time = require("ui/time")
|
||||
local util = require("util")
|
||||
local T = require("ffi/util").template
|
||||
local _ = require("gettext")
|
||||
|
||||
if G_reader_settings:hasNot("device_id") then
|
||||
G_reader_settings:saveSetting("device_id", random.uuid())
|
||||
end
|
||||
|
||||
local KOSync = WidgetContainer:extend{
|
||||
name = "kosync",
|
||||
is_doc_only = true,
|
||||
|
||||
@@ -39,6 +39,12 @@ local DataStorage = require("datastorage")
|
||||
G_reader_settings = require("luasettings"):open(
|
||||
DataStorage:getDataDir().."/settings.reader.lua")
|
||||
|
||||
local device_id = G_reader_settings:readSetting("device_id")
|
||||
if device_id == nil or device_id == "" then
|
||||
local random = require("random")
|
||||
G_reader_settings:saveSetting("device_id", random.uuid())
|
||||
end
|
||||
|
||||
-- Apply the JIT opt tweaks ASAP when the C BB is disabled,
|
||||
-- because we want to avoid the jit.flush() from bb:enableCBB,
|
||||
-- which only makes the mcode allocation issues worse on Android...
|
||||
|
||||
Reference in new issue
Block a user