kopia lustrzana https://github.com/elk-zone/elk
Merge remote-tracking branch 'origin/main' into fix/update-test-utils
commit
25a2fd6876
|
@ -22,7 +22,7 @@ jobs:
|
|||
# ref. `pnpm@10.1.0` / `pnpm@9.15.4` cannot be installed due to key id mismatch · Issue #612 · nodejs/corepack
|
||||
# - https://github.com/nodejs/corepack/issues/612#issuecomment-2629496091
|
||||
- run: npm i -g corepack@latest && corepack enable
|
||||
- uses: actions/setup-node@v4.4.0
|
||||
- uses: actions/setup-node@v5.0.0
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
check-provenance:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Check provenance downgrades
|
||||
uses: danielroe/provenance-action@41bcc969e579d9e29af08ba44fcbfdf95cee6e6c # v0.1.1
|
||||
with:
|
||||
fail-on-provenance-change: true
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
fetch-depth: 0
|
||||
|
||||
- name: Set node
|
||||
uses: actions/setup-node@v4
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version-file: .nvmrc
|
||||
|
||||
|
|
|
@ -30,12 +30,11 @@ const containerClass = computed(() => {
|
|||
sticky top-0 z-20
|
||||
pt="[env(safe-area-inset-top,0)]"
|
||||
bg="[rgba(var(--rgb-bg-base),0.7)]"
|
||||
class="native:lg:w-[calc(100vw-5rem)] native:xl:w-[calc(135%+(100vw-1200px)/2)]"
|
||||
:class="{
|
||||
'backdrop-blur': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
||||
}"
|
||||
>
|
||||
<div flex justify-between gap-2 min-h-53px px5 py1 :class="{ 'xl:hidden': $route.name !== 'tag' }" class="native:xl:flex" border="b base">
|
||||
<div flex justify-between gap-2 min-h-53px px5 py1 :class="{ 'xl:hidden': $route.name !== 'tag' }" border="b base">
|
||||
<div flex gap-2 items-center :overflow-hidden="!noOverflowHidden ? '' : false" w-full>
|
||||
<button
|
||||
v-if="backOnSmallScreen || back"
|
||||
|
@ -45,7 +44,7 @@ const containerClass = computed(() => {
|
|||
>
|
||||
<div text-lg i-ri:arrow-left-line class="rtl-flip" />
|
||||
</button>
|
||||
<div :truncate="!noOverflowHidden ? '' : false" flex w-full data-tauri-drag-region class="native-mac:justify-start native-mac:text-center">
|
||||
<div :truncate="!noOverflowHidden ? '' : false" flex w-full class="native-mac:justify-start native-mac:text-center">
|
||||
<slot name="title" />
|
||||
</div>
|
||||
<div sm:hidden h-7 w-1px />
|
||||
|
|
|
@ -13,9 +13,9 @@ watchEffect(() => {
|
|||
}
|
||||
|
||||
const duration
|
||||
= days.value * 24 * 60 * 60
|
||||
+ hours.value * 60 * 60
|
||||
+ minutes.value * 60
|
||||
= days.value * 24 * 60 * 60
|
||||
+ hours.value * 60 * 60
|
||||
+ minutes.value * 60
|
||||
|
||||
if (duration <= 0) {
|
||||
isValid.value = false
|
||||
|
|
|
@ -18,7 +18,7 @@ router.afterEach(() => {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div flex justify-between sticky top-0 bg-base z-1 py-4 native:py-7 data-tauri-drag-region>
|
||||
<div flex justify-between sticky top-0 bg-base z-1 py-4>
|
||||
<NuxtLink
|
||||
flex items-end gap-3
|
||||
py2 px-5
|
||||
|
|
|
@ -67,6 +67,11 @@ const sanitizer = sanitize({
|
|||
li: {
|
||||
value: keep,
|
||||
},
|
||||
// Hollo supports <ruby> tags
|
||||
// https://github.com/fedify-dev/hollo/blob/80e7184aa805f579be8712ff9231be655343c661/src/xss.ts#L92-L94
|
||||
ruby: {},
|
||||
rp: {},
|
||||
rt: {},
|
||||
})
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,9 +16,9 @@ const instance = instanceStorage.value[currentServer.value]
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div h-full :data-mode="isHydrated && isGrayscale ? 'grayscale' : ''" data-tauri-drag-region>
|
||||
<main flex w-full mxa lg:max-w-80rem class="native:grid native:sm:grid-cols-[auto_1fr] native:lg:grid-cols-[auto_minmax(600px,2fr)_1fr]">
|
||||
<aside class="native:w-auto w-1/8 md:w-1/6 lg:w-1/5 xl:w-1/4 zen-hide" hidden sm:flex justify-end xl:me-4 native:me-0 relative>
|
||||
<div h-full :data-mode="isHydrated && isGrayscale ? 'grayscale' : ''">
|
||||
<main flex w-full mxa lg:max-w-80rem>
|
||||
<aside class="w-1/8 md:w-1/6 lg:w-1/5 xl:w-1/4 zen-hide" hidden sm:flex justify-end xl:me-4 relative>
|
||||
<div sticky top-0 w-20 xl:w-100 h-100dvh flex="~ col" lt-xl-items-center>
|
||||
<slot name="left">
|
||||
<div flex="~ col" overflow-y-auto justify-between h-full max-w-full overflow-x-hidden>
|
||||
|
@ -60,7 +60,7 @@ const instance = instanceStorage.value[currentServer.value]
|
|||
<NavBottom v-if="isHydrated" sm:hidden />
|
||||
</div>
|
||||
</div>
|
||||
<aside v-if="isHydrated && !wideLayout" class="hidden lg:w-1/5 xl:w-1/4 sm:none xl:block native:w-full zen-hide">
|
||||
<aside v-if="isHydrated && !wideLayout" class="hidden lg:w-1/5 xl:w-1/4 sm:none xl:block zen-hide">
|
||||
<div sticky top-0 h-100dvh flex="~ col" gap-2 py3 ms-2>
|
||||
<slot name="right">
|
||||
<SearchWidget mt-4 mx-1 hidden xl:block />
|
||||
|
|
|
@ -80,7 +80,7 @@ const locales: LocaleObjectData[] = [
|
|||
file: 'en.json',
|
||||
name: 'English',
|
||||
},
|
||||
({
|
||||
{
|
||||
// @ts-expect-error ar used as placeholder
|
||||
code: 'ar',
|
||||
file: 'ar.json',
|
||||
|
@ -90,8 +90,8 @@ const locales: LocaleObjectData[] = [
|
|||
const name = new Intl.PluralRules('ar-EG').select(choice)
|
||||
return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name]
|
||||
},
|
||||
} satisfies LocaleObjectData),
|
||||
({
|
||||
} satisfies LocaleObjectData,
|
||||
{
|
||||
code: 'ckb',
|
||||
file: 'ckb.json',
|
||||
name: 'کوردیی ناوەندی',
|
||||
|
@ -100,8 +100,8 @@ const locales: LocaleObjectData[] = [
|
|||
const name = new Intl.PluralRules('ckb').select(choice)
|
||||
return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name]
|
||||
},
|
||||
} satisfies LocaleObjectData),
|
||||
({
|
||||
} satisfies LocaleObjectData,
|
||||
{
|
||||
code: 'fa-IR',
|
||||
file: 'fa-IR.json',
|
||||
name: 'فارسی',
|
||||
|
@ -110,7 +110,7 @@ const locales: LocaleObjectData[] = [
|
|||
const name = new Intl.PluralRules('fa-IR').select(choice)
|
||||
return { zero: 0, one: 1, two: 2, few: 3, many: 4, other: 5 }[name]
|
||||
},
|
||||
} satisfies LocaleObjectData),
|
||||
} satisfies LocaleObjectData,
|
||||
{
|
||||
// @ts-expect-error ca used as placeholder
|
||||
code: 'ca',
|
||||
|
|
|
@ -6,7 +6,7 @@ services:
|
|||
volumes:
|
||||
# make sure this directory has the same ownership as the elk user from the Dockerfile
|
||||
# otherwise Elk will not be able to store configs for accounts
|
||||
# e.q. mkdir ./elk-storage; sudo chown 911:911 ./elk-storage
|
||||
# e.g., mkdir ./elk-storage; sudo chown 911:911 ./elk-storage
|
||||
- './elk-storage:/elk/data'
|
||||
ports:
|
||||
- 5314:5314
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
import { rm } from 'node:fs/promises'
|
||||
import { addImports, addImportsSources, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||
import { resolveModulePath } from 'exsolve'
|
||||
|
||||
const mockProxy = resolveModulePath('mocked-exports/proxy', { from: import.meta.url })
|
||||
|
||||
export default defineNuxtModule({
|
||||
meta: {
|
||||
name: 'tauri',
|
||||
},
|
||||
setup() {
|
||||
const nuxt = useNuxt()
|
||||
const { resolve } = createResolver(import.meta.url)
|
||||
|
||||
if (!process.env.TAURI_PLATFORM)
|
||||
return
|
||||
|
||||
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': mockProxy,
|
||||
'unstorage/drivers/cloudflare-kv-http': mockProxy,
|
||||
'#storage-config': resolve('./runtime/storage-config'),
|
||||
'node:events': 'unenv/runtime/node/events/index',
|
||||
'#build-info': resolve('./runtime/build-info'),
|
||||
}
|
||||
|
||||
nuxt.hook('vite:extend', ({ config }) => {
|
||||
config.build!.target = ['chrome100', 'safari15']
|
||||
config.envPrefix = [...config.envPrefix || [], 'VITE_', 'TAURI_']
|
||||
})
|
||||
|
||||
// prevent creation of server routes
|
||||
nuxt.hook('nitro:config', (config) => {
|
||||
config.srcDir = './_nonexistent'
|
||||
config.scanDirs = []
|
||||
})
|
||||
|
||||
addImportsSources({
|
||||
from: 'h3',
|
||||
imports: ['defineEventHandler', 'getQuery', 'getRouterParams', 'readBody', 'sendRedirect'] as Array<keyof typeof import('h3')>,
|
||||
})
|
||||
|
||||
nuxt.options.imports.dirs = nuxt.options.imports.dirs || []
|
||||
nuxt.options.imports.dirs.push(resolve('../../server/utils'))
|
||||
|
||||
addImports({ name: 'useStorage', from: resolve('./runtime/storage') })
|
||||
|
||||
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')
|
||||
})
|
||||
},
|
||||
})
|
|
@ -1 +0,0 @@
|
|||
export const env = useAppConfig().env
|
|
@ -1,18 +0,0 @@
|
|||
import * as log from 'tauri-plugin-log-api'
|
||||
|
||||
// When running inside Tauri, catch all logs from 3rd party packages and direct them to the unified logging stream
|
||||
export default defineNuxtPlugin(() => {
|
||||
// eslint-disable-next-line no-global-assign
|
||||
console = {
|
||||
...console,
|
||||
trace: log.trace,
|
||||
debug: log.debug,
|
||||
log: log.info,
|
||||
warn: log.warn,
|
||||
error: log.error,
|
||||
}
|
||||
|
||||
window.addEventListener('unhandledrejection', err =>
|
||||
log.error(err.reason))
|
||||
window.addEventListener('error', err => log.error(err.error), true)
|
||||
})
|
|
@ -1,73 +0,0 @@
|
|||
import type { FetchResponse } from 'ofetch'
|
||||
import {
|
||||
createApp,
|
||||
createRouter,
|
||||
defineLazyEventHandler,
|
||||
toNodeListener,
|
||||
} from 'h3'
|
||||
import { fetchNodeRequestHandler } from 'node-mock-http'
|
||||
import { createFetch } from 'ofetch'
|
||||
|
||||
const handlers = [
|
||||
{
|
||||
route: '/api/:server/oauth',
|
||||
handler: defineLazyEventHandler(() => import('~~/server/api/[server]/oauth/[origin]').then(r => r.default || r)),
|
||||
},
|
||||
{
|
||||
route: '/api/:server/login',
|
||||
handler: defineLazyEventHandler(() => import('~~/server/api/[server]/login').then(r => r.default || r)),
|
||||
},
|
||||
{
|
||||
route: '/api/list-servers',
|
||||
handler: defineLazyEventHandler(() => import('~~/server/api/list-servers').then(r => r.default || r)),
|
||||
},
|
||||
]
|
||||
|
||||
// @ts-expect-error undeclared global window property
|
||||
window.__NUXT__.config = {
|
||||
// @ts-expect-error undeclared global window property
|
||||
...window.__NUXT__.config,
|
||||
storage: {},
|
||||
}
|
||||
|
||||
export default defineNuxtPlugin(async () => {
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const h3App = createApp({
|
||||
debug: import.meta.dev,
|
||||
// TODO: add global error handler
|
||||
// onError: (err, event) => {
|
||||
// console.log({ err, event })
|
||||
// },
|
||||
})
|
||||
|
||||
const router = createRouter()
|
||||
|
||||
for (const h of handlers)
|
||||
router.use(h.route, h.handler)
|
||||
|
||||
// @ts-expect-error TODO: fix
|
||||
h3App.use(config.app.baseURL, router)
|
||||
|
||||
const nodeHandler = toNodeListener(h3App)
|
||||
const localFetch: typeof fetch = async (input, init) => {
|
||||
if (!input.toString().startsWith('/')) {
|
||||
return globalThis.fetch(input.toString(), init)
|
||||
}
|
||||
return await fetchNodeRequestHandler(nodeHandler, input.toString(), init)
|
||||
}
|
||||
|
||||
// @ts-expect-error error types are subtly different here in a future nitro version
|
||||
globalThis.$fetch = createFetch({
|
||||
fetch: localFetch,
|
||||
Headers,
|
||||
defaults: { baseURL: config.app.baseURL },
|
||||
})
|
||||
|
||||
const route = useRoute()
|
||||
if (route.path.startsWith('/api')) {
|
||||
const result = (await ($fetch.raw as any)(route.fullPath)) as FetchResponse<unknown>
|
||||
if (result.headers.get('location'))
|
||||
location.href = result.headers.get('location')!
|
||||
}
|
||||
})
|
|
@ -1,2 +0,0 @@
|
|||
export const driver = undefined
|
||||
export const fsBase = ''
|
|
@ -1,29 +0,0 @@
|
|||
import { Store } from 'tauri-plugin-store-api'
|
||||
import { createStorage } from 'unstorage'
|
||||
|
||||
const store = new Store('.servers.dat')
|
||||
const storage = createStorage()
|
||||
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
|
||||
}
|
|
@ -40,7 +40,6 @@ export default defineNuxtConfig({
|
|||
'~~/modules/emoji-mart-translation',
|
||||
'~~/modules/purge-comments',
|
||||
'~~/modules/build-env',
|
||||
'~~/modules/tauri/index',
|
||||
'~~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module
|
||||
'stale-dep/nuxt',
|
||||
],
|
||||
|
@ -69,9 +68,7 @@ export default defineNuxtConfig({
|
|||
'~/styles/default-theme.css',
|
||||
'~/styles/vars.css',
|
||||
'~/styles/global.css',
|
||||
...process.env.TAURI_PLATFORM === 'macos'
|
||||
? []
|
||||
: ['~/styles/scrollbars.css'],
|
||||
'~/styles/scrollbars.css',
|
||||
'~/styles/tiptap.css',
|
||||
'~/styles/dropdown.css',
|
||||
],
|
||||
|
|
17
package.json
17
package.json
|
@ -2,7 +2,7 @@
|
|||
"name": "@elk-zone/elk",
|
||||
"type": "module",
|
||||
"version": "0.16.0",
|
||||
"packageManager": "pnpm@9.15.9",
|
||||
"packageManager": "pnpm@10.17.0",
|
||||
"license": "MIT",
|
||||
"homepage": "https://elk.zone/",
|
||||
"main": "./nuxt.config.ts",
|
||||
|
@ -88,7 +88,6 @@
|
|||
"masto": "^6.10.4",
|
||||
"mocked-exports": "^0.1.1",
|
||||
"node-emoji": "^2.1.3",
|
||||
"node-mock-http": "^1.0.0",
|
||||
"nuxt-security": "^2.2.0",
|
||||
"page-lifecycle": "^0.1.2",
|
||||
"pinia": "^3.0.2",
|
||||
|
@ -101,8 +100,6 @@
|
|||
"stale-dep": "^0.8.0",
|
||||
"std-env": "^3.7.0",
|
||||
"string-length": "^5.0.1",
|
||||
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log",
|
||||
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
|
||||
"theme-vitesse": "^0.8.0",
|
||||
"tiny-decode": "^0.1.3",
|
||||
"tippy.js": "^6.3.7",
|
||||
|
@ -117,8 +114,8 @@
|
|||
"ws": "^8.15.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^5.2.1",
|
||||
"@antfu/ni": "^24.4.0",
|
||||
"@antfu/eslint-config": "^5.4.1",
|
||||
"@antfu/ni": "^26.0.1",
|
||||
"@types/chroma-js": "^3.1.1",
|
||||
"@types/file-saver": "^2.0.7",
|
||||
"@types/fnando__sparkline": "^0.3.7",
|
||||
|
@ -131,11 +128,11 @@
|
|||
"@vue/test-utils": "2.4.6",
|
||||
"bumpp": "^10.2.3",
|
||||
"consola": "^3.4.2",
|
||||
"eslint": "^9.34.0",
|
||||
"eslint": "^9.36.0",
|
||||
"eslint-plugin-format": "^1.0.1",
|
||||
"flat": "^6.0.1",
|
||||
"fs-extra": "^11.3.1",
|
||||
"lint-staged": "^15.5.2",
|
||||
"lint-staged": "^16.1.6",
|
||||
"nuxt": "^3.18.1",
|
||||
"prettier": "^3.6.2",
|
||||
"sharp": "^0.34.3",
|
||||
|
@ -152,8 +149,8 @@
|
|||
}
|
||||
},
|
||||
"resolutions": {
|
||||
"nuxt-component-meta": "0.13.1",
|
||||
"unstorage": "^1.17.0",
|
||||
"nuxt-component-meta": "0.14.0",
|
||||
"unstorage": "^1.17.1",
|
||||
"vitest": "3.2.4",
|
||||
"vue": "^3.5.4"
|
||||
},
|
||||
|
|
8606
pnpm-lock.yaml
8606
pnpm-lock.yaml
Plik diff jest za duży
Load Diff
|
@ -7,7 +7,7 @@ import { flatten } from 'flat'
|
|||
import { countryLocaleVariants, currentLocales } from '../config/i18n'
|
||||
|
||||
export const localeData: [code: string, file: string[], title: string][]
|
||||
= currentLocales.map((l: any) => [l.code, l.files ? l.files : [l.file!], l.name ?? l.code])
|
||||
= currentLocales.map((l: any) => [l.code, l.files ? l.files : [l.file!], l.name ?? l.code])
|
||||
|
||||
function merge(src: Record<string, any>, dst: Record<string, any>) {
|
||||
for (const key in src) {
|
||||
|
|
|
@ -13,7 +13,7 @@ function status(id: string, filtered?: mastodon.v1.FilterContext): mastodon.v1.S
|
|||
|
||||
if (filtered) {
|
||||
fakeStatus.filtered
|
||||
= [
|
||||
= [
|
||||
{
|
||||
filter: {
|
||||
filterAction: 'hide',
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { Variant } from 'unocss'
|
||||
import process from 'node:process'
|
||||
import { variantParentMatcher } from '@unocss/preset-mini/utils'
|
||||
|
||||
import {
|
||||
|
@ -108,29 +106,14 @@ export default defineConfig({
|
|||
},
|
||||
},
|
||||
variants: [
|
||||
...(process.env.TAURI_PLATFORM
|
||||
? <Variant<any>[]>[(matcher) => {
|
||||
if (!matcher.startsWith('native:'))
|
||||
return
|
||||
return {
|
||||
matcher: matcher.slice(7),
|
||||
layer: 'native',
|
||||
}
|
||||
}]
|
||||
: []),
|
||||
...(process.env.TAURI_PLATFORM !== 'macos'
|
||||
? <Variant<any>[]>[
|
||||
(matcher) => {
|
||||
if (!matcher.startsWith('native-mac:'))
|
||||
return
|
||||
return {
|
||||
matcher: matcher.slice(11),
|
||||
layer: 'native-mac',
|
||||
}
|
||||
},
|
||||
]
|
||||
: []
|
||||
),
|
||||
(matcher) => {
|
||||
if (!matcher.startsWith('native-mac:'))
|
||||
return
|
||||
return {
|
||||
matcher: matcher.slice(11),
|
||||
layer: 'native-mac',
|
||||
}
|
||||
},
|
||||
variantParentMatcher('fullscreen', '@media (display-mode: fullscreen)'),
|
||||
variantParentMatcher('coarse-pointer', '@media (pointer: coarse)'),
|
||||
],
|
||||
|
|
Ładowanie…
Reference in New Issue