diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ed188d8..ef67a68b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## [Unreleased] +- Your account follows you between waozi.xyz sites here too, including signing out everywhere. + - The Google Play edition can optionally save and open encrypted account backups with Google Drive after Google Cloud setup. - Repeated local builds reuse storage instead of keeping a new copy for each run. diff --git a/site/build.sh b/site/build.sh index 1a53bb343..a95087ed9 100755 --- a/site/build.sh +++ b/site/build.sh @@ -98,7 +98,7 @@ write_web_app_csp_html() { src=$1 dst=$2 cache_version=$(date +%s) - csp="default-src 'self' data: blob:; connect-src 'self' https: wss: http: ws:; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://telegram.org; style-src 'self' 'unsafe-inline'; worker-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob:; frame-src https:; img-src data: https:; media-src https:; object-src 'none'" + csp="default-src 'self' data: blob:; connect-src 'self' https: wss: http: ws:; script-src 'self' 'unsafe-eval' 'unsafe-inline' https://telegram.org https://account.waozi.xyz; style-src 'self' 'unsafe-inline'; worker-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob:; frame-src https:; img-src data: https:; media-src https:; object-src 'none'" meta="" awk -v meta="$meta" -v version="$cache_version" ' diff --git a/src/app/entity_management.zi b/src/app/entity_management.zi index e51b29127..ee15083a1 100644 --- a/src/app/entity_management.zi +++ b/src/app/entity_management.zi @@ -4,6 +4,7 @@ Manage :: #import "entity/management"; Provider :: #import "entity/native_management"; Recovery :: #import "entity/recovery"; Native :: #import "entity/native_files"; +Shared :: #import "entity/shared_account"; Entity :: #import "entity/model"; Pairing :: #import "entity/pairing_client"; Publish :: #import "entity/picture_publish"; @@ -393,6 +394,10 @@ InbeManagementAction :: (context: *void, request: *Manage.ManagementRequest) -> if operation == "media" { return ifx SyncNodeSetMediaUpload(TextUntilNul(request.target[:]), request.choice == 1) then 1 else 0 } + if operation == "backup_marked" { return ifx Shared.AccountBackedUpRead(data_root(), TextUntilNul(request.owner_id[:])) then 1 else 0 } + if operation == "backup_mark" || operation == "backup_unmark" { + return ifx Shared.AccountBackedUpWrite(data_root(), TextUntilNul(request.owner_id[:]), operation == "backup_mark") then 1 else 0 + } if operation == "logout" || operation == "remote_cleared" { storage_set_sync_enabled(0) Pairing.DeviceLinkCancel() diff --git a/src/web_boot.js b/src/web_boot.js index 90f6c14fe..ecdd2c30e 100644 --- a/src/web_boot.js +++ b/src/web_boot.js @@ -26,10 +26,21 @@ window.__inbeLoadApp = function(src) { Module.__inbeRenderer = renderer; - script = document.createElement('script'); - script.async = true; - script.src = src; - document.body.appendChild(script); + function start() { + if (script) return; + script = document.createElement('script'); + script.async = true; + script.src = src; + document.body.appendChild(script); + } + // One sign-in for every waozi.xyz site; other hosts and extensions have none. + if (!/^(inbe|breeze)\.waozi\.xyz$/.test(location.hostname)) { start(); return; } + var shared = document.createElement('script'); + shared.src = 'https://account.waozi.xyz/share.js'; + shared.onload = function () { WaoziAccount.attach(Module, 2500).then(start, start); }; + shared.onerror = start; + setTimeout(start, 4000); + document.head.appendChild(shared); }; function routineRuntimeLog(text) {