1
0

Merge branch 'main' into 1931-filter-for-home-timeline

This commit is contained in:
Shinigami 2023-04-14 22:48:08 +02:00 committed by GitHub
commit ac1d5f6328
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 4291 additions and 4084 deletions

View File

@ -20,6 +20,7 @@ const relationship = $(useRelationship(account))
const namedFields = ref<mastodon.v1.AccountField[]>([])
const iconFields = ref<mastodon.v1.AccountField[]>([])
const isEditingPersonalNote = ref<boolean>(false)
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
function getFieldIconTitle(fieldName: string) {
@ -80,6 +81,19 @@ watchEffect(() => {
iconFields.value = icons
})
async function editNote(event: Event) {
if (!event.target || !('value' in event.target) || !relationship)
return
const newNote = event.target?.value as string
if (relationship.note?.trim() === newNote.trim())
return
const newNoteApiResult = await client.v1.accounts.createNote(account.id, { comment: newNote })
relationship.note = newNoteApiResult.note
}
const isSelf = $(useSelfAccount(() => account))
const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
</script>
@ -107,7 +121,11 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
</NuxtLink>
<AccountFollowButton :account="account" :command="command" />
<span inset-ie-0 flex gap-2 items-center>
<AccountMoreButton :account="account" :command="command" />
<AccountMoreButton
:account="account" :command="command"
@add-note="isEditingPersonalNote = true"
@remove-note="isEditingPersonalNote = false"
/>
<CommonTooltip v-if="!isSelf && relationship?.following" :content="getNotificationIconTitle()">
<button
:aria-pressed="isNotifiedOnPost"
@ -145,6 +163,25 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
<AccountHandle :account="account" />
</div>
</div>
<label
v-if="relationship?.note?.length !== 0 || isEditingPersonalNote"
space-y-2
pb-4
block
border="b base"
>
<div flex flex-row space-x-2 flex-v-center>
<div i-ri-edit-2-line />
<p font-medium>
{{ $t('account.profile_personal_note') }}
</p>
</div>
<textarea
input-base
:value="relationship?.note ?? ''"
@change="editNote"
/>
</label>
<div v-if="account.note" max-h-100 overflow-y-auto>
<ContentRich text-4 text-base :content="account.note" :emojis="account.emojis" />
</div>

View File

@ -7,7 +7,7 @@ const props = defineProps<{
disabled?: boolean
}>()
const account = props.account || (props.handle ? useAccountByHandle(props.handle!) : undefined)
const account = computed(() => props.account || (props.handle ? useAccountByHandle(props.handle!) : undefined))
const userSettings = useUserSettings()
defineOptions({

View File

@ -5,6 +5,11 @@ const { account } = defineProps<{
account: mastodon.v1.Account
command?: boolean
}>()
const emit = defineEmits<{
(evt: 'addNote'): void
(evt: 'removeNote'): void
}>()
let relationship = $(useRelationship(account))
const isSelf = $(useSelfAccount(() => account))
@ -63,6 +68,19 @@ async function toggleReblogs() {
const showingReblogs = !relationship?.showingReblogs
relationship = await client.v1.accounts.follow(account.id, { reblogs: showingReblogs })
}
async function addUserNote() {
emit('addNote')
}
async function removeUserNote() {
if (!relationship!.note || relationship!.note.length === 0)
return
const newNote = await client.v1.accounts.createNote(account.id, { comment: '' })
relationship!.note = newNote.note
emit('removeNote')
}
</script>
<template>
@ -112,6 +130,21 @@ async function toggleReblogs() {
@click="toggleReblogs()"
/>
<CommonDropdownItem
v-if="!relationship?.note || relationship?.note?.length === 0"
:text="$t('menu.add_personal_note', [`@${account.acct}`])"
icon="i-ri-edit-2-line"
:command="command"
@click="addUserNote()"
/>
<CommonDropdownItem
v-else
:text="$t('menu.remove_personal_note', [`@${account.acct}`])"
icon="i-ri-edit-2-line"
:command="command"
@click="removeUserNote()"
/>
<CommonDropdownItem
v-if="!relationship?.muting"
:text="$t('menu.mute_account', [`@${account.acct}`])"

View File

@ -2,7 +2,7 @@
const emit = defineEmits<{
(event: 'close'): void
}>()
const { modelValue: visible } = defineModel<{
const { modelValue: visible } = defineModels<{
modelValue?: boolean
}>()

View File

@ -3,7 +3,7 @@ defineProps<{
label: string
hover?: boolean
}>()
const { modelValue } = defineModel<{
const { modelValue } = defineModels<{
modelValue?: boolean
}>()
</script>

View File

@ -14,7 +14,7 @@ const props = withDefaults(defineProps<Props>(), {
stencilSizePercentage: 0.9,
})
const { modelValue: file } = defineModel<{
const { modelValue: file } = defineModels<{
/** Images to be cropped */
modelValue: File | null
}>()

View File

@ -22,7 +22,7 @@ const emit = defineEmits<{
(event: 'error', code: number, message: string): void
}>()
const { modelValue: file } = defineModel<{
const { modelValue: file } = defineModels<{
modelValue: FileWithHandle | null
}>()

View File

@ -4,7 +4,7 @@ defineProps<{
value: any
hover?: boolean
}>()
const { modelValue } = defineModel<{
const { modelValue } = defineModels<{
modelValue: any
}>()
</script>

View File

@ -8,7 +8,7 @@ const { options, command } = defineProps<{
command?: boolean
}>()
const { modelValue } = defineModel<{
const { modelValue } = defineModels<{
modelValue: string
}>()

View File

@ -6,7 +6,7 @@ const emit = defineEmits<{
(e: 'listUpdated', list: mastodon.v1.List): void
(e: 'listRemoved', id: string): void
}>()
const { list } = defineModel<{
const { list } = defineModels<{
list: mastodon.v1.List
}>()

View File

@ -48,7 +48,7 @@ const emit = defineEmits<{
(event: 'close',): void
}>()
const { modelValue: visible } = defineModel<{
const { modelValue: visible } = defineModels<{
/** v-model dislog visibility */
modelValue: boolean
}>()

View File

@ -14,7 +14,7 @@ const emit = defineEmits<{
(event: 'close'): void
}>()
const { modelValue } = defineModel<{
const { modelValue } = defineModels<{
modelValue: number
}>()

View File

@ -1,5 +1,5 @@
<script lang="ts" setup>
let { modelValue } = $defineModel<{
let { modelValue } = $defineModels<{
modelValue: boolean
}>()
const colorMode = useColorMode()

View File

@ -3,7 +3,7 @@ defineProps<{
title?: string
message: string
}>()
const { modelValue } = defineModel<{
const { modelValue } = defineModels<{
modelValue: boolean
}>()
</script>

View File

@ -1,5 +1,6 @@
<script setup lang="ts">
import type { Editor } from '@tiptap/core'
const { editor } = defineProps<{
editor: Editor
}>()

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import Fuse from 'fuse.js'
let { modelValue } = $defineModel<{
let { modelValue } = $defineModels<{
modelValue: string
}>()

View File

@ -3,7 +3,7 @@ const { editing } = defineProps<{
editing?: boolean
}>()
let { modelValue } = $defineModel<{
let { modelValue } = $defineModels<{
modelValue: string
}>()

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import type { mastodon } from 'masto'
const { form } = defineModel<{
const { form } = defineModels<{
form: {
fieldsAttributes: NonNullable<mastodon.v1.UpdateCredentialsParams['fieldsAttributes']>
}

View File

@ -19,11 +19,11 @@ const { client } = $(useMasto())
async function vote(e: Event) {
const formData = new FormData(e.target as HTMLFormElement)
const choices = formData.getAll('choices') as string[]
const choices = formData.getAll('choices').map(i => +i) as number[]
// Update the poll optimistically
for (const [index, option] of poll.options.entries()) {
if (choices.includes(String(index)))
if (choices.includes(index))
option.votesCount = (option.votesCount || 0) + 1
}
poll.voted = true

View File

@ -1,7 +1,7 @@
import LRU from 'lru-cache'
import { LRUCache } from 'lru-cache'
import type { mastodon } from 'masto'
const cache = new LRU<string, any>({
const cache = new LRUCache<string, any>({
max: 1000,
})

View File

@ -13,6 +13,6 @@
},
"devDependencies": {
"@nuxt-themes/docus": "^1.10.1",
"nuxt": "^3.3.2"
"nuxt": "^3.4.0"
}
}

View File

@ -34,6 +34,7 @@
"posts": "Posts",
"posts_count": "{0} Posts|{0} Post|{0} Posts",
"profile_description": "{0}'s profile header",
"profile_personal_note": "Personal Note",
"profile_unavailable": "Profile unavailable",
"request_follow": "Request to follow",
"unblock": "Unblock",
@ -225,6 +226,7 @@
"sequence_then": "then"
},
"menu": {
"add_personal_note": "Add personal note to {0}",
"block_account": "Block {0}",
"block_domain": "Block domain {0}",
"copy_link_to_post": "Copy link to this post",
@ -239,6 +241,7 @@
"mute_conversation": "Mute this post",
"open_in_original_site": "Open in original site",
"pin_on_profile": "Pin on profile",
"remove_personal_note": "Remove personal note from {0}",
"share_post": "Share this post",
"show_favourited_and_boosted_by": "Show who favorited and boosted",
"show_reblogs": "Show boosts from {0}",

View File

@ -95,6 +95,7 @@
"common": {
"end_of_list": "列表到底啦",
"error": "错误",
"fetching": "加载中...",
"in": "在",
"not_found": "无法找到相关内容",
"offline_desc": "您目前已离线,请检查网络连接。"
@ -198,6 +199,31 @@
"remove_account": "移除列表中的用户",
"save": "保存更改"
},
"magic_keys": {
"dialog_header": "快捷键",
"groups": {
"actions": {
"boost": "转发",
"command_mode": "命令面板",
"compose": "撰写",
"favourite": "喜欢",
"title": "操作",
"zen_mode": "禅模式"
},
"media": {
"title": "媒体"
},
"navigation": {
"go_to_home": "首页",
"go_to_notifications": "通知",
"next_status": "下一条帖文",
"previous_status": "上一条帖文",
"shortcut_help": "快捷键帮助",
"title": "导航"
}
},
"sequence_then": "then"
},
"menu": {
"block_account": "拉黑 {0}",
"block_domain": "拉黑域名 {0}",
@ -228,6 +254,9 @@
"unmute_conversation": "取消静音帖子",
"unpin_on_profile": "取消置顶"
},
"modals": {
"aria_label_close": "关闭"
},
"nav": {
"back": "回退",
"blocked_domains": "已拉黑的域名",
@ -373,6 +402,7 @@
"save_settings": "保存设置改动",
"subscription_error": {
"clear_error": "清除错误",
"error_hint": "你可以参考常见问题列表来尝试解决问题:{0}。",
"invalid_vapid_key": "VAPID 密钥无效。",
"permission_denied": "权限不足:请在你的浏览器中打开通知权限。",
"repo_link": "鹿鸣在 Github 上的仓库",
@ -402,6 +432,8 @@
"notifications_settings": "通知",
"preferences": {
"enable_autoplay": "开启自动播放",
"enable_data_saving": "启用数据保存",
"enable_data_saving_description": "通过阻止附件自动加载来保存数据。",
"enable_pinch_to_zoom": "启用双指缩放功能",
"github_cards": "GitHub 卡片",
"grayscale_mode": "灰色模式",
@ -561,6 +593,7 @@
"explore_posts_intro": "来自本站和分布式网络上其他站点的这些嘟文正在本站引起关注。",
"explore_tags_intro": "这些标签正在本站和分布式网络上其他站点的用户中引起关注。",
"open_editor_tools": "编辑器工具",
"pick_an_icon": "选择一个图标",
"publish_failed": "关闭编辑器上方的错误信息以重新发布帖文。",
"toggle_bold": "切换加粗",
"toggle_code_block": "切换代码块",

View File

@ -1,3 +1,4 @@
import { Buffer } from 'node:buffer'
import { readFile } from 'fs-extra'
import { createResolver } from '@nuxt/kit'
import type { ManifestOptions } from 'vite-plugin-pwa'

View File

@ -11,7 +11,7 @@ import { type LocalizedWebManifest, createI18n, pwaLocales } from './i18n'
export * from './types'
export default defineNuxtModule<VitePWANuxtOptions>({
meta: {
name: 'pwa',
name: 'elk-pwa',
configKey: 'pwa',
},
defaults: nuxt => ({

View File

@ -3,6 +3,7 @@ import { isCI, isDevelopment, isWindows } from 'std-env'
import { isPreview } from './config/env'
import { i18n } from './config/i18n'
import { pwa } from './config/pwa'
import type { BuildInfo } from './types'
const { resolve } = createResolver(import.meta.url)
@ -32,11 +33,14 @@ export default defineNuxtConfig({
'~/modules/tauri/index',
'~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module
'stale-dep/nuxt',
'@nuxt/devtools',
],
devtools: {
enabled: true,
},
experimental: {
payloadExtraction: false,
inlineSSRStyles: false,
renderJsonPayloads: true,
},
css: [
'@unocss/reset/tailwind.css',
@ -260,3 +264,11 @@ declare module 'nuxt/dist/app' {
'elk-timeline-home-filter:change': () => void
}
}
declare module '@nuxt/schema' {
interface AppConfig {
storage: any
env: BuildInfo['env']
buildInfo: BuildInfo
}
}

View File

@ -2,7 +2,7 @@
"name": "@elk-zone/elk",
"type": "module",
"version": "0.8.0",
"packageManager": "pnpm@7.30.5",
"packageManager": "pnpm@8.2.0",
"license": "MIT",
"homepage": "https://elk.zone/",
"main": "./nuxt.config.ts",
@ -31,38 +31,38 @@
"@emoji-mart/data": "^1.1.2",
"@fnando/sparkline": "^0.3.10",
"@iconify-emoji/twemoji": "^1.0.2",
"@iconify/json": "^2.2.37",
"@iconify/utils": "^2.0.12",
"@nuxt/devtools": "^0.3.0",
"@iconify/json": "^2.2.49",
"@iconify/utils": "^2.1.5",
"@nuxt/devtools": "^0.4.0",
"@nuxtjs/color-mode": "^3.2.0",
"@nuxtjs/i18n": "8.0.0-beta.10",
"@pinia/nuxt": "^0.4.6",
"@tiptap/extension-character-count": "2.0.1",
"@tiptap/extension-code-block": "2.0.1",
"@tiptap/extension-history": "2.0.1",
"@tiptap/extension-mention": "2.0.1",
"@tiptap/extension-paragraph": "2.0.1",
"@tiptap/extension-placeholder": "2.0.1",
"@tiptap/extension-text": "2.0.1",
"@tiptap/pm": "^2.0.1",
"@tiptap/starter-kit": "2.0.1",
"@tiptap/suggestion": "2.0.1",
"@tiptap/vue-3": "2.0.1",
"@unocss/nuxt": "^0.50.6",
"@vue-macros/nuxt": "^1.2.3",
"@pinia/nuxt": "^0.4.8",
"@tiptap/extension-character-count": "2.0.2",
"@tiptap/extension-code-block": "2.0.2",
"@tiptap/extension-history": "2.0.2",
"@tiptap/extension-mention": "2.0.2",
"@tiptap/extension-paragraph": "2.0.2",
"@tiptap/extension-placeholder": "2.0.2",
"@tiptap/extension-text": "2.0.2",
"@tiptap/pm": "^2.0.2",
"@tiptap/starter-kit": "2.0.2",
"@tiptap/suggestion": "2.0.2",
"@tiptap/vue-3": "2.0.2",
"@unocss/nuxt": "^0.51.4",
"@vue-macros/nuxt": "^1.2.8",
"@vueuse/core": "^9.13.0",
"@vueuse/gesture": "2.0.0-beta.1",
"@vueuse/integrations": "^9.13.0",
"@vueuse/math": "^9.13.0",
"@vueuse/motion": "2.0.0-beta.12",
"@vueuse/nuxt": "^9.13.0",
"blurhash": "^2.0.4",
"blurhash": "^2.0.5",
"browser-fs-access": "^0.33.0",
"chroma-js": "^2.4.2",
"emoji-mart": "^5.5.2",
"file-saver": "^2.0.5",
"floating-vue": "2.0.0-beta.20",
"focus-trap": "^7.2.0",
"focus-trap": "^7.4.0",
"form-data": "^4.0.0",
"fuse.js": "^6.6.2",
"github-reserved-names": "^2.0.4",
@ -70,39 +70,39 @@
"ignore-dependency-scripts": "^1.0.1",
"iso-639-1": "^2.1.15",
"js-yaml": "^4.1.0",
"lru-cache": "^7.14.1",
"masto": "^5.9.2",
"lru-cache": "^9.0.1",
"masto": "^5.11.1",
"nuxt-security": "^0.13.0",
"nuxt-vitest": "^0.6.4",
"nuxt-vitest": "^0.6.9",
"page-lifecycle": "^0.1.2",
"pinia": "^2.0.33",
"postcss-nested": "^6.0.0",
"pinia": "^2.0.34",
"postcss-nested": "^6.0.1",
"rollup-plugin-node-polyfills": "^0.2.1",
"shiki": "^0.14.0",
"shiki": "^0.14.1",
"shiki-es": "^0.2.0",
"simple-git": "^3.16.0",
"slimeform": "^0.9.0",
"simple-git": "^3.17.0",
"slimeform": "^0.9.1",
"stale-dep": "^0.6.0",
"std-env": "^3.3.1",
"std-env": "^3.3.2",
"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.6.0",
"theme-vitesse": "^0.6.4",
"tiny-decode": "^0.1.3",
"tippy.js": "^6.3.7",
"ufo": "^1.0.1",
"ufo": "^1.1.1",
"ultrahtml": "^1.2.0",
"unimport": "^2.1.0",
"unplugin-auto-import": "^0.15.0",
"vite-plugin-pwa": "^0.14.1",
"unimport": "^3.0.6",
"unplugin-auto-import": "^0.15.2",
"vite-plugin-pwa": "^0.14.7",
"vue-advanced-cropper": "^2.8.8",
"vue-virtual-scroller": "2.0.0-beta.8",
"workbox-build": "^6.5.4",
"workbox-window": "^6.5.4"
},
"devDependencies": {
"@antfu/eslint-config": "^0.38.2",
"@antfu/ni": "^0.21.2",
"@antfu/eslint-config": "^0.38.4",
"@antfu/ni": "^0.21.3",
"@types/chroma-js": "^2.4.0",
"@types/file-saver": "^2.0.5",
"@types/flat": "^5.0.2",
@ -110,18 +110,19 @@
"@types/fs-extra": "^11.0.1",
"@types/js-yaml": "^4.0.5",
"@types/prettier": "^2.7.2",
"@types/wicg-file-system-access": "^2020.9.5",
"@types/wicg-file-system-access": "^2020.9.6",
"bumpp": "^9.1.0",
"eslint": "^8.37.0",
"consola": "^3.0.1",
"eslint": "^8.38.0",
"esno": "^0.16.3",
"flat": "^5.0.2",
"fs-extra": "^11.1.1",
"lint-staged": "^13.2.0",
"nuxt": "3.3.2",
"lint-staged": "^13.2.1",
"nuxt": "3.4.0",
"prettier": "^2.8.7",
"simple-git-hooks": "^2.8.1",
"typescript": "^5.0.2",
"vitest": "^0.29.7",
"typescript": "^5.0.4",
"vitest": "^0.30.1",
"vue-tsc": "^1.2.0"
},
"pnpm": {

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
import { Buffer } from 'node:buffer'
import { join, resolve } from 'pathe'
import fs from 'fs-extra'
import { ofetch } from 'ofetch'

View File

@ -1,3 +1,4 @@
import { Buffer } from 'node:buffer'
import flatten from 'flat'
import { createResolver } from '@nuxt/kit'
import fs from 'fs-extra'