mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
feat: update extension clients for PAT auth
This commit is contained in:
parent
1cc72a47be
commit
8af4a3f9d5
5 changed files with 13 additions and 18 deletions
|
|
@ -22,11 +22,11 @@ import type {
|
|||
*
|
||||
* Auth + wire contract:
|
||||
* - Every request carries `Authorization: Bearer <token>` only. No
|
||||
* custom headers — the backend identifies the caller from the JWT
|
||||
* custom headers — the backend identifies the caller from the PAT
|
||||
* and feature-detects the API via the `capabilities` array on
|
||||
* `/health` and `/connect`.
|
||||
* - 401 surfaces as `AuthError` so the orchestrator can show the
|
||||
* "token expired, paste a fresh one" UX.
|
||||
* "token invalid or expired" UX.
|
||||
* - HealthResponse / ConnectResponse use index signatures so any
|
||||
* additive backend field (e.g. new capabilities) parses without
|
||||
* breaking the decoder. This mirrors `ConfigDict(extra='ignore')`
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ export default class SurfSensePlugin extends Plugin {
|
|||
const now = Date.now();
|
||||
if (now - this.lastAuthToastAt < 10_000) return;
|
||||
this.lastAuthToastAt = now;
|
||||
new Notice("Surfsense: API token expired or invalid. Paste a fresh token in settings.", 8000);
|
||||
new Notice("Surfsense: API token is invalid or expired. Check your token in settings.", 8000);
|
||||
}
|
||||
|
||||
async loadSettings() {
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ export class SurfSenseSettingTab extends PluginSettingTab {
|
|||
new Setting(containerEl)
|
||||
.setName("API token")
|
||||
.setDesc(
|
||||
"Paste your Surfsense API token (expires after 24 hours; re-paste when you see an auth error).",
|
||||
"Paste your Surfsense personal access token from the web app.",
|
||||
)
|
||||
.addText((text) => {
|
||||
text.inputEl.type = "password";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue