Module General EnableExplicit Procedure CheckCallback(Success, Response.s) Protected Authenticated, Root Protected Username.s If Success If ParseJSON(0, Response) Root = JSONValue(0) Authenticated = GetJSONBoolean(GetJSONMember(Root, "authenticated")) If Authenticated Username = GetJSONString(GetJSONMember(Root, "username")) EndIf FreeJSON(0) EndIf EndIf If Authenticated And Username <> "" Desktop::Open(Username) Else Login::Open() EndIf EndProcedure Procedure IDBCallback(Success, DataString.s) If Success HTTPRequest(#PB_HTTP_Get, "/api/auth/check", "", @CheckCallback()) Else Debug "IDB Init failed: " + DataString EndIf EndProcedure Procedure Init() IDB::Init("kumos", 1, "file_content,file_meta", @IDBCallback()) EndProcedure EndModule ; IDE Options = SpiderBasic 3.20 (Windows - x86) ; CursorPosition = 38 ; Folding = - ; iOSAppOrientation = 0 ; AndroidAppCode = 0 ; AndroidAppOrientation = 0 ; EnableXP ; DPIAware ; CompileSourceDirectory