From cb87bf35a963d47cdd0827d673daba65e1a3f87e Mon Sep 17 00:00:00 2001
From: Ayo
Date: Sat, 26 Jul 2025 21:32:08 +0200
Subject: [PATCH 1/4] chore: Update readme project name
---
README.md | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index 3d90a5da..20cca13d 100644
--- a/README.md
+++ b/README.md
@@ -4,10 +4,9 @@
-Elk alpha
-
+Yolk
-A nimble Mastodon web client
+Yolk is cusom fork of Elk, a nimble Mastodon client
--
2.45.2
From b854b43228cadb3d4717902eb7975f0603859a33 Mon Sep 17 00:00:00 2001
From: Ayo
Date: Sun, 23 Nov 2025 18:41:49 +0100
Subject: [PATCH 2/4] feat: check user session before subscribing to streaming
---
.../timeline/TimelineNotifications.vue | 7 +-
app/composables/masto/masto.ts | 92 +++++++++----------
2 files changed, 47 insertions(+), 52 deletions(-)
diff --git a/app/components/timeline/TimelineNotifications.vue b/app/components/timeline/TimelineNotifications.vue
index 035446e9..548e7020 100644
--- a/app/components/timeline/TimelineNotifications.vue
+++ b/app/components/timeline/TimelineNotifications.vue
@@ -14,11 +14,8 @@ const options = { limit: 30, types: filter ? [filter] : [] }
// Default limit is 20 notifications, and servers are normally caped to 30
const paginator = useMastoClient().v1.notifications.list(options)
-// streaming requires user session
-let stream: Ref
-if (currentUser.value !== undefined)
- // @ts-expect-error Type error should be fixed with the following PR to masto.js: https://github.com/neet/masto.js/pull/1355
- stream = useStreaming(client => client.user.notification.subscribe())
+// @ts-expect-error Type error should be fixed with the following PR to masto.js: https://github.com/neet/masto.js/pull/1355
+const stream = useStreaming(client => client.user.notification.subscribe())
lastAccessedNotificationRoute.value = route.path.replace(/\/notifications\/?/, '')
diff --git a/app/composables/masto/masto.ts b/app/composables/masto/masto.ts
index 3a217519..5b90ccc9 100644
--- a/app/composables/masto/masto.ts
+++ b/app/composables/masto/masto.ts
@@ -26,59 +26,57 @@ export function mastoLogin(masto: ElkMasto, user: Pick mastodon.streaming.Client | undefined
+ const createStreamingClient = (streamingApiUrl: string | undefined) => {
+ // Only create the streaming client when there is a user session
+ return streamingApiUrl && currentUser.value
+ ? createStreamingAPIClient({ streamingApiUrl, accessToken, implementation: globalThis.WebSocket })
+ : undefined
+ }
+ const streamingApiUrl = instance?.configuration?.urls?.streaming
masto.client.value = createRestAPIClient({ url, accessToken })
+ masto.streamingClient.value = createStreamingClient(streamingApiUrl)
- if (currentUser.value !== undefined) {
- createStreamingClient = (streamingApiUrl: string | undefined) => {
- return streamingApiUrl ? createStreamingAPIClient({ streamingApiUrl, accessToken, implementation: globalThis.WebSocket }) : undefined
+ // Refetch instance info in the background on login
+ masto.client.value.v2.instance.fetch().catch(error => new Promise((resolve, reject) => {
+ if (error instanceof MastoHttpError && error.statusCode === 404) {
+ return masto.client.value.v1.instance.fetch().then((newInstance) => {
+ console.warn(`Instance ${server} on version ${newInstance.version} does not support "GET /api/v2/instance" API, try converting to v2 instance... expect some errors`)
+ const v2Instance = {
+ ...newInstance,
+ domain: newInstance.uri,
+ sourceUrl: '',
+ usage: {
+ users: {
+ activeMonth: 0,
+ },
+ },
+ icon: [],
+ apiVersions: {
+ mastodon: newInstance.version,
+ },
+ contact: {
+ email: newInstance.email,
+ },
+ configuration: {
+ ...(newInstance.configuration ?? {}),
+ urls: {
+ streaming: newInstance.urls.streamingApi,
+ },
+ },
+ } as unknown as mastodon.v2.Instance
+ return resolve(v2Instance)
+ }).catch(reject)
}
- const streamingApiUrl = instance?.configuration?.urls?.streaming
- masto.streamingClient.value = createStreamingClient(streamingApiUrl)
+ return reject(error)
+ })).then((newInstance) => {
+ Object.assign(instance, newInstance)
+ if (newInstance.configuration.urls.streaming !== streamingApiUrl)
+ masto.streamingClient.value = createStreamingClient(newInstance.configuration.urls.streaming)
- // Refetch instance info in the background on login
- masto.client.value.v2.instance.fetch().catch(error => new Promise((resolve, reject) => {
- if (error instanceof MastoHttpError && error.statusCode === 404) {
- return masto.client.value.v1.instance.fetch().then((newInstance) => {
- console.warn(`Instance ${server} on version ${newInstance.version} does not support "GET /api/v2/instance" API, try converting to v2 instance... expect some errors`)
- const v2Instance = {
- ...newInstance,
- domain: newInstance.uri,
- sourceUrl: '',
- usage: {
- users: {
- activeMonth: 0,
- },
- },
- icon: [],
- apiVersions: {
- mastodon: newInstance.version,
- },
- contact: {
- email: newInstance.email,
- },
- configuration: {
- ...(newInstance.configuration ?? {}),
- urls: {
- streaming: newInstance.urls.streamingApi,
- },
- },
- } as unknown as mastodon.v2.Instance
- return resolve(v2Instance)
- }).catch(reject)
- }
-
- return reject(error)
- })).then((newInstance) => {
- Object.assign(instance, newInstance)
- if (newInstance.configuration.urls.streaming !== streamingApiUrl)
- masto.streamingClient.value = createStreamingClient(newInstance.configuration.urls.streaming)
-
- instanceStorage.value[server] = newInstance
- })
- }
+ instanceStorage.value[server] = newInstance
+ })
return instance
}
--
2.45.2
From 1aae94b4dcd3eb7c2a5f2401bb9a25e1b11c828f Mon Sep 17 00:00:00 2001
From: Ayo
Date: Sun, 23 Nov 2025 19:29:43 +0100
Subject: [PATCH 3/4] feat: remove unnecessary tauri files
---
modules/tauri/runtime/storage.ts | 41 --------------------------------
1 file changed, 41 deletions(-)
delete mode 100644 modules/tauri/runtime/storage.ts
diff --git a/modules/tauri/runtime/storage.ts b/modules/tauri/runtime/storage.ts
deleted file mode 100644
index 3c546b38..00000000
--- a/modules/tauri/runtime/storage.ts
+++ /dev/null
@@ -1,41 +0,0 @@
-import { Store } from 'tauri-plugin-store-api'
-import { createStorage } from 'unstorage'
-import redisDriver from 'unstorage/drivers/redis'
-
-const store = new Store('.servers.dat')
-
-/**
- * TODO: Use redis as storage
- * - docs: https://unstorage.unjs.io/drivers/redis
- * - then we can probably remove need for `/elk/data` (see docker-compose)
- */
-const storage = createStorage({
- driver: redisDriver({
- base: 'unstorage:elk:',
- }),
-})
-
-storage.mount('servers', {
- getKeys() {
- return store.keys()
- },
- async removeItem(key: string) {
- await store.delete(key)
- },
- clear() {
- return store.clear()
- },
- hasItem(key: string) {
- return store.has(key)
- },
- setItem(key: string, value: any) {
- return store.set(key, value)
- },
- getItem(key: string) {
- return store.get(key)
- },
-})
-
-export function useStorage() {
- return storage
-}
--
2.45.2
From da52d23086563825c8e6059bdea14fe88666e501 Mon Sep 17 00:00:00 2001
From: Ayo
Date: Sun, 23 Nov 2025 19:35:52 +0100
Subject: [PATCH 4/4] feat: set unstorage driver to 'fs'
---
nuxt.config.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nuxt.config.ts b/nuxt.config.ts
index 098f84a9..6ba7fc68 100644
--- a/nuxt.config.ts
+++ b/nuxt.config.ts
@@ -144,7 +144,7 @@ export default defineNuxtConfig({
},
appConfig: {
storage: {
- driver: process.env.NUXT_STORAGE_DRIVER ?? (isCI ? 'cloudflare' : 'fs'),
+ driver: 'fs',
},
},
runtimeConfig: {
--
2.45.2