forked from Mirrors/elk
Merge branch 'main' into feature/emoji-autocomplete
This commit is contained in:
commit
02892f6819
20 changed files with 79 additions and 42 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -1,5 +1,7 @@
|
|||
name: ci
|
||||
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
|
|
3
.github/workflows/release.yml
vendored
3
.github/workflows/release.yml
vendored
|
@ -1,5 +1,8 @@
|
|||
name: Release
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
|
|
|
@ -15,7 +15,7 @@ const error = $ref(false)
|
|||
:key="account.avatar"
|
||||
width="400"
|
||||
height="400"
|
||||
:src="error ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
|
||||
:src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
|
||||
:alt="$t('account.avatar_description', [account.username])"
|
||||
loading="lazy"
|
||||
:class="(loaded ? 'bg-base' : 'bg-gray:10') + (square ? ' ' : ' rounded-full')"
|
||||
|
|
|
@ -38,19 +38,6 @@ onMounted(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<Transition>
|
||||
<img v-if="isLoaded || !placeholderSrc" v-bind="$attrs" :src="src" :srcset="srcset" absolute>
|
||||
<img v-else v-bind="$attrs" :src="placeholderSrc" absolute>
|
||||
</Transition>
|
||||
<img v-bind="$attrs" :src="placeholderSrc" z-0 aria-hidden>
|
||||
<img v-if="isLoaded || !placeholderSrc" v-bind="$attrs" :src="src" :srcset="srcset">
|
||||
<img v-else v-bind="$attrs" :src="placeholderSrc">
|
||||
</template>
|
||||
|
||||
<style>
|
||||
.v-enter-active {
|
||||
transition: opacity 0.3s ease;
|
||||
}
|
||||
|
||||
.v-enter-from {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -47,8 +47,15 @@ function toggleDark() {
|
|||
{{ $t('nav.built_at', [$d(buildTimeDate, 'shortDate')]) }}
|
||||
</span>
|
||||
·
|
||||
<!-- TODO click version to show changelog -->
|
||||
<span v-if="buildInfo.env === 'release'">v{{ buildInfo.version }}</span>
|
||||
<NuxtLink
|
||||
v-if="buildInfo.env === 'release'"
|
||||
external
|
||||
:href="`https://github.com/elk-zone/elk/releases/tag/v${buildInfo.version}`"
|
||||
target="_blank"
|
||||
font-mono
|
||||
>
|
||||
v{{ buildInfo.version }}
|
||||
</NuxtLink>
|
||||
<span v-else>{{ buildInfo.env }}</span>
|
||||
<template v-if="buildInfo.commit && buildInfo.branch !== 'release'">
|
||||
·
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { PushSubscriptionError } from '~/composables/push-notifications/types'
|
||||
|
||||
defineProps<{ show?: boolean }>()
|
||||
|
||||
const {
|
||||
|
@ -76,8 +78,13 @@ const doSubscribe = async () => {
|
|||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err)
|
||||
subscribeError = t('settings.notifications.push_notifications.subscription_error.request_error')
|
||||
if (err instanceof PushSubscriptionError) {
|
||||
subscribeError = t(`settings.notifications.push_notifications.subscription_error.${err.code}`)
|
||||
}
|
||||
else {
|
||||
console.error(err)
|
||||
subscribeError = t('settings.notifications.push_notifications.subscription_error.request_error')
|
||||
}
|
||||
showSubscribeError = true
|
||||
}
|
||||
finally {
|
||||
|
|
|
@ -4,6 +4,7 @@ import type {
|
|||
PushManagerSubscriptionInfo,
|
||||
RequiredUserLogin,
|
||||
} from '~/composables/push-notifications/types'
|
||||
import { PushSubscriptionError } from '~/composables/push-notifications/types'
|
||||
|
||||
export const createPushSubscription = async (
|
||||
user: RequiredUserLogin,
|
||||
|
@ -41,8 +42,11 @@ export const createPushSubscription = async (
|
|||
)
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.code === 20 && error.name === 'AbortError')
|
||||
console.warn('Your browser supports Web Push Notifications, but does not seem to implement the VAPID protocol.')
|
||||
let useError: PushSubscriptionError | Error = error
|
||||
if (error.code === 11 && error.name === 'InvalidStateError')
|
||||
useError = new PushSubscriptionError('too_many_registrations', 'Too many registrations')
|
||||
else if (error.code === 20 && error.name === 'AbortError')
|
||||
console.error('Your browser supports Web Push Notifications, but does not seem to implement the VAPID protocol.')
|
||||
else if (error.code === 5 && error.name === 'InvalidCharacterError')
|
||||
console.error('The VAPID public key seems to be invalid:', vapidKey)
|
||||
|
||||
|
@ -54,6 +58,9 @@ export const createPushSubscription = async (
|
|||
console.error(e)
|
||||
return Promise.resolve(undefined)
|
||||
})
|
||||
.finally(() => {
|
||||
return Promise.reject(useError)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -24,3 +24,12 @@ export interface CustomEmojisInfo {
|
|||
lastUpdate: number
|
||||
emojis: mastodon.v1.CustomEmoji[]
|
||||
}
|
||||
|
||||
export type PushSubscriptionErrorCode = 'too_many_registrations'
|
||||
export class PushSubscriptionError extends Error {
|
||||
code: PushSubscriptionErrorCode
|
||||
constructor(code: PushSubscriptionErrorCode, message?: string) {
|
||||
super(message)
|
||||
this.code = code
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ export function clearUserLocalStorage(account?: mastodon.v1.Account) {
|
|||
|
||||
const id = `${account.acct}@${currentInstance.value?.uri || currentServer.value}`
|
||||
// @ts-expect-error bind value to the function
|
||||
;(useUserLocalStorage._ as Map<string, Ref<Record<string, any>>>).forEach((storage) => {
|
||||
;(useUserLocalStorage._ as Map<string, Ref<Record<string, any>>> | undefined)?.forEach((storage) => {
|
||||
if (storage.value[id])
|
||||
delete storage.value[id]
|
||||
})
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
"title": "Elk في عرض مسبق"
|
||||
},
|
||||
"language": {
|
||||
"none": "لا شيء",
|
||||
"search": "بحث"
|
||||
},
|
||||
"menu": {
|
||||
|
|
|
@ -84,7 +84,6 @@
|
|||
"title": "Elk ist in der Alpha!"
|
||||
},
|
||||
"language": {
|
||||
"none": "Keine",
|
||||
"search": "Suche"
|
||||
},
|
||||
"menu": {
|
||||
|
|
|
@ -238,7 +238,8 @@
|
|||
"clear_error": "Clear error",
|
||||
"permission_denied": "Permission denied: enable notifications in your browser.",
|
||||
"request_error": "An error occurred while requesting the subscription, try again and if the error persists, please report the issue to the Elk repository.",
|
||||
"title": "Could not subscribe to push notifications"
|
||||
"title": "Could not subscribe to push notifications",
|
||||
"too_many_registrations": "Due to browser limitations, Elk cannot use the push notifications service for multiple accounts on different servers. You should unsubscribe from push notifications on another accounts and try again."
|
||||
},
|
||||
"undo_settings": "Undo changes",
|
||||
"unsubscribe": "Disable push notifications",
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
"title": "Elk is in Preview!"
|
||||
},
|
||||
"language": {
|
||||
"none": "None",
|
||||
"search": "Search"
|
||||
},
|
||||
"menu": {
|
||||
|
@ -303,7 +302,8 @@
|
|||
"clear_error": "Clear error",
|
||||
"permission_denied": "Permission denied: enable notifications in your browser.",
|
||||
"request_error": "An error occurred while requesting the subscription, try again and if the error persists, please report the issue to the Elk repository.",
|
||||
"title": "Could not subscribe to push notifications"
|
||||
"title": "Could not subscribe to push notifications",
|
||||
"too_many_registrations": "Due to browser limitations, Elk cannot use the push notifications service for multiple accounts on different servers. You should unsubscribe from push notifications on another accounts and try again."
|
||||
},
|
||||
"title": "Push notifications settings",
|
||||
"undo_settings": "Undo changes",
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
"title": "¡Elk está en Vista Previa!"
|
||||
},
|
||||
"language": {
|
||||
"none": "Ninguno",
|
||||
"search": "Buscar"
|
||||
},
|
||||
"menu": {
|
||||
|
@ -295,7 +294,8 @@
|
|||
"clear_error": "Limpiar error",
|
||||
"permission_denied": "Permiso denegado: habilita las notificaciones en tu navegador.",
|
||||
"request_error": "Se produjo un error al solicitar la suscripción, inténtalo de nuevo y si el error persiste, notifica la incidencia en el repositorio de Elk.",
|
||||
"title": "No se pudo suscribir a las notificaciones push"
|
||||
"title": "No se pudo suscribir a las notificaciones push",
|
||||
"too_many_registrations": "Debido a las limitaciones del navegador, Elk no puede habilitar las notificaciones push para múltiples cuentas en diferentes servidores. Deberá cancelar las subscripciones a notificaciones push en las otras cuentas e intentarlo de nuevo."
|
||||
},
|
||||
"title": "Ajustes de notificaciones push",
|
||||
"undo_settings": "Deshacer cambios",
|
||||
|
|
|
@ -161,7 +161,7 @@
|
|||
"blocked_domains": "Domaines bloqués",
|
||||
"blocked_users": "Utilisateur·ice·s bloqué·e·s",
|
||||
"bookmarks": "Marque-pages",
|
||||
"built_at": "Dernier build {0}",
|
||||
"built_at": "Dernière compilation {0}",
|
||||
"conversations": "Conversations",
|
||||
"explore": "Explorer",
|
||||
"favourites": "Appréciés",
|
||||
|
@ -232,7 +232,13 @@
|
|||
"settings": {
|
||||
"about": {
|
||||
"label": "À propos",
|
||||
"meet_the_team": "Rencontrez l'équipe"
|
||||
"meet_the_team": "Rencontrez l'équipe",
|
||||
"sponsor_action": "Soutenez-nous",
|
||||
"sponsor_action_desc": "Pour financer l'équipe développant Elk",
|
||||
"sponsors": "Donateur·ice·s",
|
||||
"sponsors_body_1": "Elk existe grâce au généreux soutien de :",
|
||||
"sponsors_body_2": "Et toutes les personnes et sociétés soutenant l'équipe Elk et ses membres.",
|
||||
"sponsors_body_3": "Si vous appréciez l'application, envisagez de nous soutenir :"
|
||||
},
|
||||
"account_settings": {
|
||||
"description": "Modifiez les paramètres de votre compte dans l'interface de Mastodon",
|
||||
|
@ -257,7 +263,8 @@
|
|||
"sm": "Petite",
|
||||
"xl": "Très grande",
|
||||
"xs": "Très petite"
|
||||
}
|
||||
},
|
||||
"system_mode": "Système"
|
||||
},
|
||||
"language": {
|
||||
"display_language": "Langue d'affichage",
|
||||
|
@ -266,10 +273,7 @@
|
|||
"notifications": {
|
||||
"label": "Notifications",
|
||||
"notifications": {
|
||||
"label": "Paramètres des notifications",
|
||||
"notifications": {
|
||||
"label": "sqds"
|
||||
}
|
||||
"label": "Paramètres des notifications"
|
||||
},
|
||||
"push_notifications": {
|
||||
"alerts": {
|
||||
|
|
|
@ -114,7 +114,6 @@
|
|||
"title": "Elk is in Preview!"
|
||||
},
|
||||
"language": {
|
||||
"none": "Niets",
|
||||
"search": "Opzoeken"
|
||||
},
|
||||
"menu": {
|
||||
|
|
|
@ -123,7 +123,6 @@
|
|||
"title": "Elk у попередньому перегляді!"
|
||||
},
|
||||
"language": {
|
||||
"none": "Жодного",
|
||||
"search": "Пошук"
|
||||
},
|
||||
"menu": {
|
||||
|
|
|
@ -120,7 +120,6 @@
|
|||
"title": "预览鹿鸣!"
|
||||
},
|
||||
"language": {
|
||||
"none": "无",
|
||||
"search": "搜索"
|
||||
},
|
||||
"menu": {
|
||||
|
@ -162,7 +161,7 @@
|
|||
"blocked_domains": "已拉黑的域名",
|
||||
"blocked_users": "已拉黑的用户",
|
||||
"bookmarks": "书签",
|
||||
"built_at": "于 {0}构建",
|
||||
"built_at": "构建于 {0}",
|
||||
"conversations": "私信",
|
||||
"explore": "探索",
|
||||
"favourites": "喜欢",
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { rm } from 'fs/promises'
|
||||
import { addImports, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||
|
||||
export default defineNuxtModule({
|
||||
|
@ -14,6 +15,9 @@ export default defineNuxtModule({
|
|||
if (nuxt.options.dev)
|
||||
nuxt.options.ssr = false
|
||||
|
||||
nuxt.options.pwa.disable = true
|
||||
nuxt.options.sourcemap.client = false
|
||||
|
||||
nuxt.options.alias = {
|
||||
...nuxt.options.alias,
|
||||
'unstorage/drivers/fs': 'unenv/runtime/mock/proxy',
|
||||
|
@ -36,5 +40,16 @@ export default defineNuxtModule({
|
|||
|
||||
addPlugin(resolve('./runtime/logging.client'))
|
||||
addPlugin(resolve('./runtime/nitro.client'))
|
||||
|
||||
// cleanup files copied from the public folder that we don't need
|
||||
nuxt.hook('close', async () => {
|
||||
await rm('.output/public/_redirects')
|
||||
await rm('.output/public/apple-touch-icon.png')
|
||||
await rm('.output/public/elk-og.png')
|
||||
await rm('.output/public/favicon.ico')
|
||||
await rm('.output/public/pwa-192x192.png')
|
||||
await rm('.output/public/pwa-512x512.png')
|
||||
await rm('.output/public/robots.txt')
|
||||
})
|
||||
},
|
||||
})
|
||||
|
|
|
@ -28,8 +28,8 @@ export default defineNuxtConfig({
|
|||
'~/modules/purge-comments',
|
||||
'~/modules/setup-components',
|
||||
'~/modules/build-env',
|
||||
'~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module
|
||||
'~/modules/tauri/index',
|
||||
'~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module
|
||||
],
|
||||
experimental: {
|
||||
payloadExtraction: false,
|
||||
|
|
Loading…
Reference in a new issue