finish URL rewrite, remove redundant logged_in state

This commit is contained in:
ari melody 2024-07-07 14:58:59 +01:00
parent a3fdd0007c
commit 4d771d8ebd
Signed by: ari
GPG key ID: CF99829C92678188
9 changed files with 20 additions and 27 deletions

View file

@ -1,6 +1,6 @@
<script>
import * as api from '$lib/api.js';
import { account, logged_in } from '$lib/stores/account.js';
import { account } from '$lib/stores/account.js';
import { server } from '$lib/client/server.js';
import { app } from '$lib/client/app.js';
import { play_sound } from '$lib/sound.js';
@ -8,7 +8,6 @@
import { getNotifications } from '$lib/notifications.js';
import { goto } from '$app/navigation';
import { page } from '$app/stores';
import { get } from 'svelte/store';
import { createEventDispatcher } from 'svelte';
import { unread_notif_count } from '$lib/notifications.js';
@ -32,7 +31,7 @@
const dispatch = createEventDispatcher();
function handle_btn(name) {
if (!get(logged_in)) return;
if (!$account) return;
let route;
switch (name) {
case "timeline":
@ -63,16 +62,15 @@
if (!confirm("This will log you out. Are you sure?")) return;
const res = await api.revokeToken(
get(server).host,
get(app).id,
get(app).secret,
get(app).token
$server.host,
$app.id,
$app.secret,
$app.token
);
if (!res.ok)
console.warn("Token revocation failed! Dumping data anyways");
logged_in.set(false);
account.set(false);
app.set(false);
server.set(false);

View file

@ -1,12 +1,12 @@
<script>
import * as api from '$lib/api.js';
import { server } from '$lib/client/server';
import { goto } from '$app/navigation';
import ReplyIcon from '$lib/../img/icons/reply.svg';
import RepostIcon from '$lib/../img/icons/repost.svg';
import FavouriteIcon from '$lib/../img/icons/like.svg';
import ReactIcon from '$lib/../img/icons/react.svg';
import QuoteIcon from '$lib/../img/icons/quote.svg';
// import QuoteIcon from '$lib/../img/icons/quote.svg';
import ReactionBar from '$lib/ui/post/ReactionBar.svelte';
import ActionBar from '$lib/ui/post/ActionBar.svelte';
@ -54,7 +54,7 @@
event.ctrlKey)) return;
if (event.key && event.key !== "Enter") return;
}
goto(`/post/${data.status.id}`);
goto(`/${$server.host}/${data.status.account.mention}/${data.status.id}`);
}
let aria_label = function (data) {

View file

@ -1,9 +1,9 @@
<script>
import { server } from '$lib/client/server';
import { goto } from '$app/navigation';
import PostHeader from './PostHeader.svelte';
import Body from './Body.svelte';
import Post from './Post.svelte';
import ActionBar from './ActionBar.svelte';
import ReactionBar from './ReactionBar.svelte';
@ -22,7 +22,7 @@
event.ctrlKey)) return;
if (event.key && event.key !== "Enter") return;
}
goto(`/post/${post.id}`);
goto(`/${$server.host}/${post.account.mention}/${post.id}`);
}
</script>