Compare commits

...

3 commits

Author SHA1 Message Date
thislight
48b417e005
configure local debugging options
All checks were successful
/ depoly (push) Successful in 1m20s
2024-07-23 14:16:35 +08:00
thislight
c204bdd70b
Settings: prefetching toots 2024-07-23 08:28:47 +08:00
thislight
c25ca17043
createTimeSource: fix type error 2024-07-22 22:04:56 +08:00
7 changed files with 159 additions and 5 deletions

View file

@ -13,7 +13,7 @@ const TimeSourceContext = createContext<Accessor<Date>>();
export const TimeSourceProvider = TimeSourceContext.Provider; export const TimeSourceProvider = TimeSourceContext.Provider;
export function createTimeSource() { export function createTimeSource() {
let id: number | undefined; let id: ReturnType<typeof setTimeout> | undefined;
const [get, set] = createSignal(new Date()); const [get, set] = createSignal(new Date());
createRenderEffect(() => createRenderEffect(() =>

View file

@ -23,9 +23,12 @@ import { css } from "solid-styled";
import { useSignedInProfiles } from "../masto/acct.js"; import { useSignedInProfiles } from "../masto/acct.js";
import { signOut, type Account } from "../accounts/stores.js"; import { signOut, type Account } from "../accounts/stores.js";
import { intlFormat } from "date-fns"; import { intlFormat } from "date-fns";
import { useStore } from "@nanostores/solid";
import { $settings } from "./stores.js";
const Settings: ParentComponent = () => { const Settings: ParentComponent = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const settings$ = useStore($settings);
const [profiles] = useSignedInProfiles(); const [profiles] = useSignedInProfiles();
@ -96,7 +99,12 @@ const Settings: ParentComponent = () => {
Prefetch Toots Prefetch Toots
</ListItemText> </ListItemText>
<ListItemSecondaryAction> <ListItemSecondaryAction>
<Switch /> <Switch
checked={!settings$().prefetchTootsDisabled}
onChange={(e) =>
$settings.setKey("prefetchTootsDisabled", !e.target.checked)
}
/>
</ListItemSecondaryAction> </ListItemSecondaryAction>
</ListItem> </ListItem>
</li> </li>

View file

@ -2,6 +2,10 @@ import { persistentMap } from "@nanostores/persistent";
type Settings = { type Settings = {
onGoingOAuth2Process?: string onGoingOAuth2Process?: string
prefetchTootsDisabled?: boolean
} }
export const $settings = persistentMap<Settings>("settings::", {}) export const $settings = persistentMap<Settings>("settings::", {}, {
encode: JSON.stringify,
decode: JSON.parse
})

View file

@ -35,6 +35,8 @@ import { Create as CreateTootIcon } from "@suid/icons-material";
import { useTimeline } from "../masto/timelines"; import { useTimeline } from "../masto/timelines";
import { makeEventListener } from "@solid-primitives/event-listener"; import { makeEventListener } from "@solid-primitives/event-listener";
import BottomSheet from "../material/BottomSheet"; import BottomSheet from "../material/BottomSheet";
import { $settings } from "../settings/stores";
import { useStore } from "@nanostores/solid";
const TimelinePanel: Component<{ const TimelinePanel: Component<{
client: mastodon.rest.Client; client: mastodon.rest.Client;
@ -153,12 +155,13 @@ const Home: ParentComponent = (props) => {
useDocumentTitle("Timelines"); useDocumentTitle("Timelines");
const now = createTimeSource(); const now = createTimeSource();
const settings$ = useStore($settings)
const sessions = useSessions(); const sessions = useSessions();
const client = () => sessions()[0].client; const client = () => sessions()[0].client;
const [profile] = useAcctProfile(client); const [profile] = useAcctProfile(client);
const [panelOffset, setPanelOffset] = createSignal(0); const [panelOffset, setPanelOffset] = createSignal(0);
const [prefetching, setPrefetching] = createSignal(true); const prefetching = () => !settings$().prefetchTootsDisabled
const [currentFocusOn, setCurrentFocusOn] = createSignal<HTMLElement[]>([]); const [currentFocusOn, setCurrentFocusOn] = createSignal<HTMLElement[]>([]);
const [focusRange, setFocusRange] = createSignal([0, 0] as readonly [ const [focusRange, setFocusRange] = createSignal([0, 0] as readonly [
number, number,
@ -279,7 +282,7 @@ const Home: ParentComponent = (props) => {
</Tab> </Tab>
</Tabs> </Tabs>
<ProfileMenuButton profile={profile()}> <ProfileMenuButton profile={profile()}>
<MenuItem onClick={(e) => setPrefetching((x) => !x)}> <MenuItem onClick={(e) => $settings.setKey("prefetchTootsDisabled", !$settings.get().prefetchTootsDisabled)}>
<ListItemText>Prefetch Toots</ListItemText> <ListItemText>Prefetch Toots</ListItemText>
<ListItemSecondaryAction> <ListItemSecondaryAction>
<Switch checked={prefetching()}></Switch> <Switch checked={prefetching()}></Switch>

View file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7bo/0ykbgzm3oEOweQWyVvivFSs5vFQH6S
0S0BiGjR0TySkPf0m5CwKw6ujuH1VeKKKrhK3r0URYEM/pKFeGxDTYga+gM4eZib
4/Zydcjygv+4WgdoPdBCEOMhhuoB1q3NXA+0zKVZAoGBAIHR7Udk8rzwuno5IGc8
AgdMhkDojqQaDJdJlAAmmX1IoqJOpyGdws+uUtQ/YnnNqQn2eTTlPxnl5ldtBYmR
iT8XWLi4jIsY0jh6fLCaZwcu4RB0Rrw1N6nsZQFr/PG61ZPa8RJBfAGRE3QWc3WN
L/Q1JdU0auJcvQn78yA/gLVp
-----END PRIVATE KEY-----

View file

@ -17,9 +17,20 @@ export default defineConfig(({ mode }) => ({
}), }),
VitePWA({ VitePWA({
registerType: "autoUpdate", registerType: "autoUpdate",
devOptions: {
enabled: mode === "staging",
},
}), }),
version(), version(),
], ],
server: {
https: {
// localhost.direct: https://github.com/Upinel/localhost.direct
key: "tools/certs/localhost.direct.key",
cert: "tools/certs/localhost.direct.crt",
passphrase: "localhost",
},
},
define: { define: {
"import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`, "import.meta.env.BUILT_AT": `"${new Date().toISOString()}"`,
}, },