From 58be2ccaf8bbceeb901a85a7508db6172b8c694e Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Wed, 7 Oct 2026 03:25:56 -0500 Subject: [PATCH] refactor: rename diigo-dump to diigo-cache Pure rename ahead of the dump worker's evolution into a bookmark cache (goal 1c), so history follows the files. The diigo-login helper script is dropped: the cookie now enters through webapp's mint form, never a local script. --- {diigo-dump => diigo-cache}/README.md | 0 {diigo-dump => diigo-cache}/package.json | 0 {diigo-dump => diigo-cache}/pnpm-lock.yaml | 0 {diigo-dump => diigo-cache}/src/diigo.ts | 0 {diigo-dump => diigo-cache}/src/index.ts | 0 {diigo-dump => diigo-cache}/tsconfig.json | 0 {diigo-dump => diigo-cache}/wrangler.jsonc | 0 diigo-dump/scripts/diigo-login | 56 ---------------------- 8 files changed, 56 deletions(-) rename {diigo-dump => diigo-cache}/README.md (100%) rename {diigo-dump => diigo-cache}/package.json (100%) rename {diigo-dump => diigo-cache}/pnpm-lock.yaml (100%) rename {diigo-dump => diigo-cache}/src/diigo.ts (100%) rename {diigo-dump => diigo-cache}/src/index.ts (100%) rename {diigo-dump => diigo-cache}/tsconfig.json (100%) rename {diigo-dump => diigo-cache}/wrangler.jsonc (100%) delete mode 100755 diigo-dump/scripts/diigo-login diff --git a/diigo-dump/README.md b/diigo-cache/README.md similarity index 100% rename from diigo-dump/README.md rename to diigo-cache/README.md diff --git a/diigo-dump/package.json b/diigo-cache/package.json similarity index 100% rename from diigo-dump/package.json rename to diigo-cache/package.json diff --git a/diigo-dump/pnpm-lock.yaml b/diigo-cache/pnpm-lock.yaml similarity index 100% rename from diigo-dump/pnpm-lock.yaml rename to diigo-cache/pnpm-lock.yaml diff --git a/diigo-dump/src/diigo.ts b/diigo-cache/src/diigo.ts similarity index 100% rename from diigo-dump/src/diigo.ts rename to diigo-cache/src/diigo.ts diff --git a/diigo-dump/src/index.ts b/diigo-cache/src/index.ts similarity index 100% rename from diigo-dump/src/index.ts rename to diigo-cache/src/index.ts diff --git a/diigo-dump/tsconfig.json b/diigo-cache/tsconfig.json similarity index 100% rename from diigo-dump/tsconfig.json rename to diigo-cache/tsconfig.json diff --git a/diigo-dump/wrangler.jsonc b/diigo-cache/wrangler.jsonc similarity index 100% rename from diigo-dump/wrangler.jsonc rename to diigo-cache/wrangler.jsonc diff --git a/diigo-dump/scripts/diigo-login b/diigo-dump/scripts/diigo-login deleted file mode 100755 index 9be6021..0000000 --- a/diigo-dump/scripts/diigo-login +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# diigo-login: OBSOLETE but kept for terminals: superseded by the /_connect -# page flow (paste the cookie in the browser form; no clipboard/askpass). -# Prompt for the diigo.com session cookie via SSH_ASKPASS, verify it -# against the interact_api (one page), mint the webapp instance via the -# running dev server, and write the instance id to stdout (for -# `>> .dev.vars`). The cookie itself lives only in the DO's storage — -# never on disk, never in logs. -# -# usage: pnpm -s diigo-login >> .dev.vars (dev server must be up; needs -# a display for the GUI prompt) -set -eu - -: "${SSH_ASKPASS:=/usr/bin/ssh-askpass}" -export SSH_ASKPASS - -# the prompt text (SSH_ASKPASS_PROMPT is what ksshaskpass/gnome-askpass read) -export SSH_ASKPASS_PROMPT="diigo.com login: paste the Cookie header from devtools" - -cookie=$(DISPLAY="${DISPLAY:-:0}" "$SSH_ASKPASS" 2>/dev/null) || { - echo "$0: askpass failed (need a display; or export SSH_ASKPASS yourself)" >&2 - exit 1 -} -[ -n "$cookie" ] || { - echo "$0: empty cookie" >&2 - exit 1 -} - -# verify before committing anything: the endpoint the worker will use, -# with the same headers WebApp will send -target='https://www.diigo.com/interact_api/load_user_items?sort=updated&count=1&page_num=1' -status=$(curl -s -o /dev/null -w '%{http_code}' \ - -H "cookie: $cookie" \ - -H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) Gecko/20100101 Firefox/141.0' \ - -H 'x-requested-with: XMLHttpRequest' \ - "$target") -[ "$status" = 200 ] || { - echo "$0: diigo said $status for that cookie; not writing .dev.vars" >&2 - exit 1 -} - -# mint the webapp instance (persist id: the instance keeps the cookie, so -# re-running this mint only replaces an *invalid* cookie). /_mint speaks -# the browser form protocol: proxyMint is html, not json. -minted=$(curl -s -D /tmp/opencode/diigo-mint-headers -X POST http://localhost:8787/_mint \ - --data-urlencode "cookie=$cookie") || { - echo "$0: could not reach the dev server at :8787 (is it up?)" >&2 - exit 1 -} -webapp_id=$(grep -i '^x-diigo-web-id:' /tmp/opencode/diigo-mint-headers | tr -d '\r' | awk '{print $2}') -[ -n "$webapp_id" ] || { - echo "$0: mint failed; server said: $(printf '%s' "$minted" | tr -d '\n' | head -c 200)" >&2 - exit 1 -} - -printf 'DIIGO_WEB_ID="%s"\n' "$webapp_id" \ No newline at end of file