chore: rename to Elk

This commit is contained in:
Anthony Fu 2022-11-23 21:06:27 +08:00
parent 674879cb7f
commit 129e12c217
12 changed files with 35 additions and 69 deletions

View file

@ -1,5 +1,5 @@
# Nuxtodon
# Elk
A Mastodon web client powered by Nuxt.
A Mastodon web client made with 💚.
> Very WIP.

View file

@ -1,9 +1,11 @@
<script setup>
import { APP_NAME } from './constants'
useHead({
title: 'Nuxtodon',
title: APP_NAME,
link: [
{
rel: 'icon', type: 'image/svg+xml', href: '/nuxtodon.svg',
rel: 'icon', type: 'image/svg+xml', href: '/logo.svg',
},
],
})

View file

@ -8,7 +8,7 @@ const buildTimeAgo = useTimeAgo(buildTime)
<template>
<div p4 text-sm op25 flex="~ col">
<button i-ri-sun-line dark:i-ri-moon-line text-lg mb4 @click="toggleDark()" />
<div>A Mastodon client by Nuxt</div>
<div>Built <span :title="buildTime">{{ buildTimeAgo }}</span> · <a href="https://github.com/antfu/nuxtodon" target="_blank">GitHub</a></div>
<div>A Mastodon client made with 💚</div>
<div>Built <span :title="buildTime">{{ buildTimeAgo }}</span> · <a href="https://github.com/antfu/elk" target="_blank">GitHub</a></div>
</div>
</template>

View file

@ -1,8 +1,8 @@
<template>
<NuxtLink flex text-2xl gap-2 to="/">
<img aria-label="Nuxtodon Logo" src="/nuxtodon.svg" width="25" height="25">
<img aria-label="Elk Logo" src="/logo.svg" width="25" height="25">
<div>
Nuxtodon <sup text-sm italic op50 mt-1>Prototype</sup>
Elk <sup text-sm italic op50 mt-1>alpha</sup>
</div>
</NuxtLink>
</template>

View file

@ -12,7 +12,7 @@ const {
}>()
let isSending = $ref(false)
const storageKey = `nuxtodon-draft-${draftKey}`
const storageKey = `elk-draft-${draftKey}`
function getDefaultStatus(): CreateStatusParamsWithStatus {
return {
status: '',

View file

@ -1,42 +0,0 @@
import { emojisArrayToObject } from './utils'
import type { ServerInfo } from '~/types'
const ServerInfoTTL = 60 * 60 * 1000 * 12 // 12 hour
const serverInfoPromise = new Map<string, Promise<ServerInfo>>()
const serverInfos = useLocalStorage<Record<string, ServerInfo>>('nuxtodon-server-info', {})
async function _fetchServerInfo(server: string) {
if (!serverInfos.value[server]) {
// @ts-expect-error init
serverInfos.value[server] = {
timeUpdated: 0,
server,
}
}
if (serverInfos.value[server].timeUpdated + ServerInfoTTL < Date.now()) {
await Promise.allSettled([
masto.instances.fetch().then((r) => {
Object.assign(serverInfos.value[server], r)
}),
masto.customEmojis.fetchAll().then((r) => {
serverInfos.value[server].customEmojis = emojisArrayToObject(r)
}),
])
}
return serverInfos.value[server]
}
export function fetchServerInfo(server: string) {
if (!serverInfoPromise.has(server))
serverInfoPromise.set(server, _fetchServerInfo(server))
return serverInfoPromise.get(server)!
}
export function useServerInfo(server: string) {
const info = ref<ServerInfo | undefined>()
fetchServerInfo(server).then((r) => {
info.value = r
})
return info
}

View file

@ -1,9 +1,9 @@
import { login as loginMasto } from 'masto'
import type { UserLogin } from '~/types'
import { DEFAULT_SERVER } from '~/constants'
import { DEFAULT_SERVER, STORAGE_KEY_CURRENT_USER, STORAGE_KEY_USERS } from '~/constants'
const users = useLocalStorage<UserLogin[]>('nuxtodon-accounts', [], { deep: true })
const currentUserId = useLocalStorage<string>('nuxtodon-current-user', '')
const users = useLocalStorage<UserLogin[]>(STORAGE_KEY_USERS, [], { deep: true })
const currentUserId = useLocalStorage<string>(STORAGE_KEY_CURRENT_USER, '')
export const currentUser = computed<UserLogin | undefined>(() => {
let user: UserLogin | undefined

View file

@ -1,7 +1,13 @@
export const APP_NAME = 'Nuxtodon'
export const APP_NAME = 'Elk'
export const HOST_DOMAIN = process.dev
? 'http://localhost:3000'
: 'https://nuxtodon.netlify.app'
: 'https://elk.zone'
export const DEFAULT_SERVER = 'mas.to'
export const STORAGE_KEY_DRAFTS = 'elk-drafts'
export const STORAGE_KEY_USERS = 'elk-users'
export const STORAGE_KEY_CURRENT_USER = 'elk-current-user'
export const STORAGE_KEY_NOTIFY_TAB = 'elk-notify-tab'

View file

@ -1,10 +1,12 @@
<script setup lang="ts">
import { STORAGE_KEY_NOTIFY_TAB } from '~/constants'
definePageMeta({
middleware: 'auth',
})
const tabNames = ['All', 'Mentions'] as const
const tab = $(useLocalStorage<typeof tabNames[number]>('nuxtodon-notifications-tab', 'All'))
const tab = $(useLocalStorage<typeof tabNames[number]>(STORAGE_KEY_NOTIFY_TAB, 'All'))
const paginator = $computed(() => {
return masto.notifications.getIterator(tab === 'All' ? undefined : { types: ['mention'] })

8
public/logo.svg Normal file
View file

@ -0,0 +1,8 @@
<svg width="250" height="250" viewBox="0 0 250 250" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M131.676 48.2479C122.848 49.273 118.156 46.9152 115.331 55.3212C115.331 55.3212 124.815 69.6216 150.09 69.2628C148.677 75.106 149.333 79.4115 149.333 84.5884C149.333 101.81 135.712 116.828 105.695 116.828C90.4593 116.828 71.9446 119.596 57.8189 127.336C47.7796 132.82 39.9247 140.765 36.4488 151.785L40.3888 157.372L47.931 157.474V189.099L38.7291 203.605L41.3726 245.635H50.1003L50.857 211.806C55.1956 209.243 65.134 202.58 73.6094 192.329C85.1118 178.541 93.9403 158.5 83.5478 133.692L91.317 130.36C99.8428 150.709 96.8663 168.341 89.3999 182.539C103.677 182.077 115.936 181.155 126.328 179.412L123.957 150.555L132.332 149.837L140.303 245.635H148.98L150.443 183.256C157.355 180.283 173.095 169.366 180.46 131.436C181.368 126.823 181.873 122.928 182.125 119.596C183.285 111.139 183.941 101.605 184.143 90.7391L171.783 86.7924H209.771L213.454 78.3352C209.872 78.4889 205.584 76.5925 205.584 76.5925L206.441 72.492H214.412L171.278 49.7855C166.486 51.6308 161.441 54.0398 157.909 56.9614C155.084 54.9112 145.297 48.5041 131.676 48.2479Z" fill="#EA9E44"/>
<path d="M165.174 185.512C169.714 180.591 174.961 173.671 179.855 164.394C180.006 168.238 180.258 170.545 180.46 171.724L202.809 190.893L185.959 224.107L178.392 220.519L188.935 196.173L165.174 185.512Z" fill="#C16929"/>
<path d="M84.0523 191.15C90.5098 191.047 96.5636 190.791 102.264 190.432C94.9493 201.35 86.0703 209.192 82.3875 212.267V245.584H73.7608L69.3717 207.142C74.6184 202.734 79.6633 197.044 84.0523 191.15Z" fill="#C16929"/>
<path d="M58.4243 6.24353L66.5466 3.93701C70.4816 18.1862 75.3751 25.9771 81.5299 29.9238C87.0793 33.2913 94.5962 33.3836 102.567 32.9479C100.246 32.1791 98.0771 31.1027 96.0592 29.6163C91.5692 26.2846 87.7351 20.749 84.8595 10.7028L92.9313 8.29378C95.1006 15.8797 97.6231 20.2364 101.003 22.748C104.383 25.2083 108.47 25.8233 113.313 26.3359C122.393 27.361 133.744 27.7711 147.921 34.4344C149.838 35.1519 151.805 36.0746 153.722 37.0997L153.722 37.0996C153.47 36.587 153.218 36.0745 152.865 35.5107C150.443 31.6665 145.701 27.6173 136.923 24.3369L139.748 16.341C154.025 21.5691 159.675 29.0012 161.945 34.8957C164.569 41.6102 162.954 46.8639 162.954 46.8639C160.936 47.5303 158.918 48.4529 156.598 49.1705C152.209 46.1464 148.072 43.8655 144.137 42.0715C129.608 36.5871 115.381 40.3288 102.769 41.5077C93.2845 42.379 84.6073 41.969 77.0904 37.1509C69.6744 32.4354 63.1665 23.4143 58.4243 6.24353Z" fill="#C16929"/>
<path d="M113.918 19.9802C112.253 16.1872 111.244 11.5229 111.698 5.78223L120.073 6.3973C119.568 13.3681 121.99 18.0837 124.714 21.159C121.183 20.544 117.803 20.4722 113.918 19.9802Z" fill="#C16929"/>
<path d="M166.889 19.1088L172.388 12.7018C186.665 25.3108 177.786 43.3529 177.786 43.3529L169.967 42.4816C169.715 38.3606 169.21 30.7029 165.578 26.3872C167.949 27.6019 169.967 28.9397 172.187 30.9489C172.187 27.2073 171.026 22.7992 166.889 19.1088Z" fill="#C16929"/>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -1,11 +0,0 @@
<svg width="65" height="65" viewBox="0 0 61 65" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M60.7539 14.3904C59.8143 7.40642 53.7273 1.90257 46.5117 0.836066C45.2943 0.655854 40.6819 0 29.9973 0H29.9175C19.2299 0 16.937 0.655854 15.7196 0.836066C8.70488 1.87302 2.29885 6.81852 0.744617 13.8852C-0.00294988 17.3654 -0.0827298 21.2237 0.0561464 24.7629C0.254119 29.8384 0.292531 34.905 0.753482 39.9598C1.07215 43.3175 1.62806 46.6484 2.41704 49.9276C3.89445 55.9839 9.87499 61.0239 15.7344 63.0801C22.0077 65.2244 28.7542 65.5804 35.2184 64.1082C35.9295 63.9428 36.6318 63.7508 37.3252 63.5321C38.8971 63.0329 40.738 62.4745 42.0913 61.4937C42.1099 61.4799 42.1251 61.4621 42.1358 61.4417C42.1466 61.4212 42.1526 61.3986 42.1534 61.3755V56.4773C42.153 56.4557 42.1479 56.4345 42.1383 56.4151C42.1287 56.3958 42.1149 56.3788 42.0979 56.3655C42.0809 56.3522 42.0611 56.3429 42.04 56.3382C42.019 56.3335 41.9971 56.3336 41.9761 56.3384C37.8345 57.3276 33.5905 57.8234 29.3324 57.8156C22.0045 57.8156 20.0336 54.3384 19.4693 52.8908C19.0156 51.6397 18.7275 50.3346 18.6124 49.0088C18.6112 48.9866 18.6153 48.9643 18.6243 48.9439C18.6333 48.9236 18.647 48.9056 18.6643 48.8915C18.6816 48.8774 18.7019 48.8675 18.7237 48.8628C18.7455 48.858 18.7681 48.8585 18.7897 48.8641C22.8622 49.8465 27.037 50.3423 31.2265 50.3412C32.234 50.3412 33.2387 50.3412 34.2463 50.3146C38.4598 50.1964 42.9009 49.9808 47.0465 49.1713C47.1499 49.1506 47.2534 49.1329 47.342 49.1063C53.881 47.8507 60.1038 43.9097 60.7362 33.9301C60.7598 33.5372 60.8189 29.8148 60.8189 29.4071C60.8218 28.0215 61.2651 19.5781 60.7539 14.3904Z" fill="url(#paint0_linear_89_8)"/>
<path transform="translate(10 3) scale(0.33)" fill-rule="evenodd" clip-rule="evenodd" d="M55.7498 27.1551C52.5277 21.615 44.4723 21.6149 41.2502 27.1551L6.13404 87.5346C2.91191 93.0748 6.93956 100 13.3838 100H40.7975C38.0438 97.5934 37.0241 93.4303 39.1079 89.8584L65.7033 44.2694L55.7498 27.1551Z" fill="white"/>
<path transform="translate(10 3) scale(0.33)" d="M78.0002 40.3997C80.6668 35.8668 87.3332 35.8668 89.9998 40.3997L119.061 89.801C121.728 94.3339 118.395 100 113.062 100H54.9383C49.6052 100 46.2719 94.3339 48.9385 89.801L78.0002 40.3997Z" fill="white"/>
<defs>
<linearGradient id="paint0_linear_89_8" x1="30.5" y1="0" x2="30.5" y2="65" gradientUnits="userSpaceOnUse">
<stop stop-color="#80EEC0"/>
<stop offset="0.2" stop-color="#00DC82"/>
</linearGradient>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -11,7 +11,8 @@ const KNOWN_SERVERS = [
const KNOWN_DOMAINS = [
'http://localhost:3000',
'https://nuxtodon.netlify.app',
'https://elk.netlify.app',
'https://elk.zone',
]
const filename = 'public/registered-apps.json'