Compare commits

..

2 commits

Author SHA1 Message Date
thislight
3afda89dfc
Upgrade dependencies
All checks were successful
/ depoly (push) Successful in 1m10s
* upgrade suid to v0.16
* upgrade @solidjs/router to v0.14
* upgrade nanostores to v0.11
* upgrade minor changed dependencies
2024-09-14 15:56:40 +08:00
thislight
71487dfbb3
start of 1.0.6 2024-09-14 15:19:09 +08:00
3 changed files with 28 additions and 43 deletions

BIN
bun.lockb

Binary file not shown.

View file

@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package",
"name": "tutu",
"version": "1.0.5",
"version": "1.0.6",
"description": "",
"private": true,
"type": "module",
@ -14,35 +14,35 @@
"author": "Rubicon",
"license": "Apache-2.0",
"devDependencies": {
"@suid/vite-plugin": "^0.2.0",
"@suid/vite-plugin": "^0.3.0",
"@types/hammerjs": "^2.0.45",
"postcss": "^8.4.41",
"postcss": "^8.4.45",
"prettier": "^3.3.3",
"typescript": "^5.5.4",
"vite": "^5.4.0",
"typescript": "^5.6.2",
"vite": "^5.4.5",
"vite-plugin-package-version": "^1.1.0",
"vite-plugin-pwa": "^0.20.1",
"vite-plugin-pwa": "^0.20.5",
"vite-plugin-solid": "^2.10.2",
"vite-plugin-solid-styled": "^0.11.1",
"wrangler": "^3.70.0"
"wrangler": "^3.78.2"
},
"dependencies": {
"@nanostores/persistent": "^0.9.1",
"@nanostores/persistent": "^0.10.2",
"@nanostores/solid": "^0.4.2",
"@solid-primitives/event-listener": "^2.3.3",
"@solid-primitives/intersection-observer": "^2.1.6",
"@solid-primitives/resize-observer": "^2.0.26",
"@solidjs/router": "^0.11.5",
"@suid/icons-material": "^0.7.0",
"@suid/material": "^0.16.0",
"@solidjs/router": "^0.14.5",
"@suid/icons-material": "^0.8.0",
"@suid/material": "^0.17.0",
"blurhash": "^2.0.5",
"colorjs.io": "^0.5.2",
"date-fns": "^3.6.0",
"fast-average-color": "^9.4.0",
"hammerjs": "^2.0.8",
"masto": "^6.8.0",
"nanostores": "^0.9.5",
"solid-js": "^1.8.20",
"nanostores": "^0.11.3",
"solid-js": "^1.8.22",
"solid-styled": "^0.11.1",
"stacktrace-js": "^2.0.2",
"web-animations-js": "^2.3.2"

View file

@ -4,7 +4,6 @@ import {
createRestAPIClient,
type mastodon,
} from "masto";
import { action } from "nanostores";
import { createMastoClientFor } from "../masto/clients";
export type Account = {
@ -57,10 +56,8 @@ async function oauth2TokenViaAuthCode(app: RegisteredApp, authCode: string) {
}
}
export const acceptAccountViaAuthCode = action(
$accounts,
"acceptAccount",
async ($store, site: string, authCode: string) => {
export async function acceptAccountViaAuthCode(site: string, authCode: string) {
const $store = $accounts;
const app = $registeredApps.get()[site];
if (!app) {
throw TypeError("application not found");
@ -79,29 +76,20 @@ export const acceptAccountViaAuthCode = action(
$store.set(all);
return acct;
},
);
}
export const updateAcctInf = action(
$accounts,
"updateAcctInf",
async ($store, idx: number) => {
const o = $store.get();
export async function updateAcctInf(idx: number) {
const o = $accounts.get();
const client = createMastoClientFor(o[idx]);
const inf = await client.v1.accounts.verifyCredentials();
o[idx].inf = inf;
$store.set(o);
$accounts.set(o);
return inf;
},
);
}
export const signOut = action(
$accounts,
"signOut",
($store, predicate: (acct: Account) => boolean) => {
$store.set($store.get().filter((a) => !predicate(a)));
},
);
export function signOut(predicate: (acct: Account) => boolean) {
$accounts.set($accounts.get().filter((a) => !predicate(a)));
}
export type RegisteredApp = {
site: string;
@ -140,10 +128,8 @@ async function getAppAccessToken(app: RegisteredApp) {
return dict.access_token;
}
export const getOrRegisterApp = action(
$registeredApps,
"getOrRegisterApp",
async ($store, site: string, redirectUrl: string) => {
export async function getOrRegisterApp(site: string, redirectUrl: string) {
const $store = $registeredApps;
const all = $store.get();
const savedApp = all[site];
if (savedApp && savedApp.redirectUrl === redirectUrl) {
@ -198,5 +184,4 @@ export const getOrRegisterApp = action(
};
$store.set(all);
return all[site];
},
);
}