feat: GitHub Gist and custom HTTP URL cloud sync

GitHub Gist sync:
- pushToGist(token): pushes all settings to a private Gist; creates a
  new Gist on first use and stores the Gist ID in local storage so
  subsequent pushes update the same Gist.
- pullFromGist(token): fetches the Gist, compares lastModified, applies
  if newer (raw_url used to avoid API truncation).
- No desktop client needed; works across any browser/OS with a GitHub PAT.
- Options page shows a token field + Push/Pull buttons; Gist ID shown
  once linked.

Custom URL sync:
- pushToUrl({ url, method, headers }): HTTP PUT to any endpoint.
- pullFromUrl({ url, headers }): HTTP GET, applies if newer.
- Works with Nextcloud/ownCloud WebDAV, self-hosted servers, cloud
  functions, or any static-file host that allows PUT.
- Options page shows URL + optional JSON headers field + Push/Pull.

Both methods write ss_sync_notification on apply, triggering the purple
'SYN' badge and desktop notification added in the previous commit.

https://claude.ai/code/session_01TKpSR9M8JgHLXCp5CeDsQP
This commit is contained in:
Claude
2026-03-26 14:44:18 +00:00
parent 1e475196d6
commit cbe5b8584d
3 changed files with 290 additions and 7 deletions
+40
View File
@@ -158,6 +158,46 @@
</div>
<div id="fileSyncStatus" style="margin-top:6px;font-size:12px;min-height:16px"></div>
</div>
<div style="margin-top:20px;padding-top:16px;border-top:1px solid #e5e7eb">
<h3 style="font-size:13px;font-weight:600;margin:0 0 4px">GitHub Gist Sync — no desktop client needed</h3>
<p class="section-desc" style="margin-bottom:8px">
Store settings in a private GitHub Gist. Works across any browser or device
with just a GitHub account. Create a
<a href="https://github.com/settings/tokens/new?scopes=gist&description=SilentSend" target="_blank" rel="noopener">
Personal Access Token
</a>
with the <code>gist</code> scope, paste it below, and click Push.
The Gist ID is remembered — future pushes update the same Gist.
</p>
<div style="display:flex;gap:8px;margin-bottom:6px;flex-wrap:wrap">
<input type="password" id="gistToken" placeholder="GitHub PAT (ghp_…)" autocomplete="off"
style="flex:1;min-width:180px;font-family:monospace;font-size:12px;padding:5px 8px;border:1px solid #d1d5db;border-radius:6px">
<button class="btn btn-primary" id="btnGistPush">Push</button>
<button class="btn" id="btnGistPull">Pull</button>
</div>
<div id="gistSyncStatus" style="font-size:12px;min-height:16px"></div>
</div>
<div style="margin-top:20px;padding-top:16px;border-top:1px solid #e5e7eb">
<h3 style="font-size:13px;font-weight:600;margin:0 0 4px">Custom URL Sync</h3>
<p class="section-desc" style="margin-bottom:8px">
Any URL that supports HTTP GET (read) and PUT (write). Works with
Nextcloud/ownCloud WebDAV, a self-hosted server, or a cloud function.
Add custom headers (e.g. Authorization) as JSON if needed.
</p>
<div style="display:flex;gap:8px;margin-bottom:6px;flex-wrap:wrap">
<input type="url" id="customSyncUrl" placeholder="https://…/silent-send-sync.json"
style="flex:2;min-width:200px;font-size:12px;padding:5px 8px;border:1px solid #d1d5db;border-radius:6px">
<input type="text" id="customSyncHeaders" placeholder='{"Authorization":"Bearer …"}' autocomplete="off"
style="flex:1;min-width:160px;font-family:monospace;font-size:11px;padding:5px 8px;border:1px solid #d1d5db;border-radius:6px">
</div>
<div class="bulk-actions">
<button class="btn btn-primary" id="btnUrlPush">Push</button>
<button class="btn" id="btnUrlPull">Pull</button>
</div>
<div id="urlSyncStatus" style="margin-top:6px;font-size:12px;min-height:16px"></div>
</div>
</section>
<section class="section">