diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..46154788 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,19 @@ +# Modified from .gitignore +node_modules +*.log +dist +.output +.nuxt +#.env # Not ignoring this file because it can contain build-related settings. +.DS_Store +.idea/ +.vite-inspect +.netlify/ +.eslintcache + +public/shiki +public/emojis + +*~ +*swp +*swo diff --git a/.env.example b/.env.example index a21e7f83..a0aebb6b 100644 --- a/.env.example +++ b/.env.example @@ -1,5 +1,6 @@ NUXT_PUBLIC_TRANSLATE_API= NUXT_PUBLIC_DEFAULT_SERVER= +NUXT_PUBLIC_PRIVACY_POLICY_URL= # Production only NUXT_CLOUDFLARE_ACCOUNT_ID= @@ -10,6 +11,8 @@ NUXT_CLOUDFLARE_API_TOKEN= NUXT_STORAGE_DRIVER= NUXT_STORAGE_FS_BASE= +NUXT_ADMIN_KEY= + NUXT_PUBLIC_DISABLE_VERSION_CHECK= NUXT_GITHUB_CLIENT_ID= diff --git a/.eslintignore b/.eslintignore index a5104c82..b2365300 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,5 +3,9 @@ *.ico *.toml *.patch +*.txt +Dockerfile +public/ https-dev-config/localhost.crt https-dev-config/localhost.key +Dockerfile diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 8abe4458..4ef6738c 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ -github: [antfu, patak-dev, sxzz, danielroe] +github: [elk-zone] +open_collective: elk diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..a76d8646 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,5 @@ +--- +name: 🐞 Bug report +about: Report an issue +labels: ['s: pending triage', 'c: bug'] +--- diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index a97f3365..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: 🐞 Bug report -description: Report an issue -labels: ['s: pending triage', 'c: bug'] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - If you are unsure whether your problem is a bug or not, you can check the following: - - - use our [Discord community](https://chat.elk.zone) - - open a new [discussion](https://github.com/elk-zone/elk/discussions) and ask your question there - - - type: checkboxes - id: checkboxes - attributes: - label: Pre-Checks - description: Before submitting the issue, please make sure you do the following - options: - # - label: Follow our [Code of Conduct](https://github.com/elk-zone/elk/blob/main/CODE_OF_CONDUCT.md). - # required: true - # - label: Read the [Contributing Guidelines](https://github.com/elk-zone/elk/blob/main/CONTRIBUTING.md). - # required: true - - label: Check that there isn't [already an issue](https://github.com/elk-zone/elk/issues) that reports the same bug to avoid creating a duplicate. - required: true - - label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/elk-zone/elk/discussions) or join our [Discord Chat Server](https://chat.elk.zone). - required: true - - label: Providing a screenshot or video to reproduce the issue or show visually what was meant. - required: true - - label: I am willing to provide a PR. - - - type: textarea - id: bug-description - attributes: - label: Describe the bug - description: A clear and concise description of what the bug is. - placeholder: I am doing ... What I expect is ... What actually happening is ... - validations: - required: true - - - type: textarea - id: reproduction - attributes: - label: Reproduction video or screenshot - description: | - A video or screenshot that visually shows the issue. - **Tip:** You can attach images or recordings files by clicking this area to highlight it and then dragging files in. - - - type: textarea - id: additional-context - attributes: - label: Additional Context - description: | - Anything else relevant? Please tell us here, e.g. your used web browser and/or you are on desktop or mobile. - **Tip:** You can attach images or recordings files by clicking this area to highlight it and then dragging files in. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..1bf9f7fc --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,5 @@ +--- +name: 🚀 New feature proposal +about: Propose a new feature +labels: 's: pending triage' +--- \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index 478c620f..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,35 +0,0 @@ -name: 🚀 New feature proposal -description: Propose a new feature -labels: ['s: pending triage'] # This will automatically assign the 's: pending triage' label -body: - - type: markdown - attributes: - value: Thanks for your interest in the project and taking the time to fill out this feature report! - - - type: textarea - id: feature-description - attributes: - label: Clear and concise description of the problem - description: 'As a user I want [goal / wish] so that [benefit]. If you intend to submit a PR for this issue, tell us in the description. Thanks!' - validations: - required: true - - - type: textarea - id: suggested-solution - attributes: - label: Suggested solution - description: 'In section [xy] we could provide following feature...' - validations: - required: true - - - type: textarea - id: alternative - attributes: - label: Alternative - description: Clear and concise description of any alternative solutions or features you've considered. - - - type: textarea - id: additional-context - attributes: - label: Additional context - description: Any other context about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/freestyle.md b/.github/ISSUE_TEMPLATE/freestyle.md deleted file mode 100644 index 642eec30..00000000 --- a/.github/ISSUE_TEMPLATE/freestyle.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -name: Freestyle Report -about: Create a report to help us improve -labels: 'pending triage' # This will automatically assign the 'pending triage' label ---- \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a554d46f..3ed97488 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,7 @@ name: ci +permissions: {} + on: push: branches: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 00000000..8e277a70 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,46 @@ +name: build & push docker container +on: + push: + branches: + - main + tags: + - '*' + pull_request: + branches: + - main +jobs: + docker: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Docker meta + id: metal + uses: docker/metadata-action@v4 + with: + images: | + ghcr.io/elk-zone/elk + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push + uses: docker/build-push-action@v3 + with: + context: . + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.metal.outputs.tags }} + labels: ${{ steps.metal.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e302c364..be309421 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,8 @@ name: Release +permissions: + contents: write + on: push: tags: diff --git a/.npmrc b/.npmrc index e2ad808f..e4a0f0b7 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,4 @@ shamefully-hoist=true strict-peer-dependencies=false shell-emulator=true +ignore-workspace-root-check=true diff --git a/.stackblitz/codeflow.json b/.stackblitz/codeflow.json new file mode 100644 index 00000000..21acb9d4 --- /dev/null +++ b/.stackblitz/codeflow.json @@ -0,0 +1,7 @@ +{ + "bot": { + "issues": { + "trigger": "all-issues" + } + } +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e68e4e73..a2bae242 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,9 +4,13 @@ Hi! We are really excited that you are interested in contributing to Elk. Before Refer also to https://github.com/antfu/contribute. -## Set up your local development environment +### Online -The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) (Note: on Linux in a standard Node 16+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command). +You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow). + +[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk) + +### Local Setup To develop and test the Elk package: @@ -14,22 +18,37 @@ To develop and test the Elk package: 2. Ensure using the latest Node.js (16.x) -3. Elk uses pnpm v7, you must enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. +3. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) v7. To use it you must first enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. (Note: on Linux in a standard Node 16+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command) 4. Check out a branch where you can work and commit your changes: ```shell git checkout -b my-new-branch ``` -5. Run `pnpm i` in Elk's root folder +1. Run `pnpm i` in Elk's root folder -6. Run `pnpm nuxi prepare` in Elk's root folder +2. Run `pnpm nuxi prepare` in Elk's root folder -7. Run `pnpm dev` in Elk's root folder to start dev server or `pnpm dev:mocked` to start dev server with `@elkdev@universeodon.com` user. +3. Run `pnpm dev` in Elk's root folder to start dev server or `pnpm dev:mocked` to start dev server with `@elkdev@universeodon.com` user. + +We recommend installing [ni](https://github.com/antfu/ni#ni), that will use the right package manager in each of your projects. If `ni` is installed, you can instead run: + +``` +ni +nr dev +``` + +### Testing + +Elk uses [Vitest](https://vitest.dev). You can run the test suite with: + +``` +nr test +``` ### Running PWA on dev server -In order to run Elk with PWA enabled, run `pnpm run dev:pwa` in Elk's root folder to start dev server or `pnpm dev:mocked:pwa` to start dev server with `@elkdev@universeodon.com` user. +In order to run Elk with PWA enabled, run `pnpm dev:pwa` in Elk's root folder to start dev server or `pnpm dev:mocked:pwa` to start dev server with `@elkdev@universeodon.com` user. You should test the Elk PWA application on private browsing mode on any Chromium based browser: will not work on Firefox and Safari. @@ -72,11 +91,19 @@ We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://i ### Adding a new language -1. Add a new file in [locales](../locales) folder with the language code as the filename. -2. Copy [en-US](../locales/en-US.json) and translate the strings. -3. Add the language to the `locales` array in [config/i18n.ts](../config/i18n.ts#L13) -4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar-EG](../config/i18n.ts#L63) -5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar-EG](../config/i18n.ts#L64) +1. Add a new file in [locales](./locales) folder with the language code as the filename. +2. Copy [en-US](./locales/en-US.json) and translate the strings. +3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts#L61), below `en` and `ar`: + - If your language have multiple country variants, add the generic one for language only (only if there are a lot of common entries, you can always add it as a new one) + - Add all country variants in [country variants object](./config/i18n.ts#L12) + - Add all country variants files with empty `messages` object: `{}` + - Translate the strings in the generic language file + - Later, when anyone wants to add the corresponding translations for the country variant, just override any entry in the corresponding file: you can see an example with `en` variants. + - If the generic language already exists: + - If the translation doesn't differ from the generic language, then add the corresponding translations in the corresponding file + - If the translation differs from the generic language, then add the corresponding translations in the corresponding file and remove it from the country variants entry +4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar](./config/i18n.ts#L71) +5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar](./config/i18n.ts#L72) Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info. @@ -139,14 +166,14 @@ You can run this code in your browser console to see how it works: Either **{0}** or **{v}** should be used with the exception being custom plurals entries using the `{n}` placeholder. This is the full list of entries that will be available for number formatting in Elk: -- `action.boost_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `action.favourite_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `action.reply_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `account.followers_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `account.following_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `account.posts_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `compose.drafts`: `{v}` for formatted number and `{n}` for raw number - **{v} should be use** -- `notification.followed_you_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `status.poll.count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use** -- `time_ago_options.*`: `{0}` for formatted number and `{n}` for raw number - **{0} should be use**: since numbers will be always small, we can also use `{n}` -- `timeline.show_new_items`: `{v}` for formatted number and `{n}` for raw number - **{v} should be use** +- `action.boost_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `action.favourite_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `action.reply_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `account.followers_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `account.following_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `account.posts_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `compose.drafts`: `{v}` for formatted number and `{n}` for raw number - **{v} should be used** +- `notification.followed_you_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `status.poll.count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used** +- `time_ago_options.*`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**: since numbers will be always small, we can also use `{n}` +- `timeline.show_new_items`: `{v}` for formatted number and `{n}` for raw number - **{v} should be used** diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..389fef03 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,56 @@ +FROM docker.io/library/node:lts-alpine AS base + +# Prepare work directory +WORKDIR /elk + +FROM base AS builder + +# Prepare pnpm https://pnpm.io/installation#using-corepack +RUN corepack enable + +# Prepare deps +RUN apk update +RUN apk add git --no-cache + +# Prepare build deps ( ignore postinstall scripts for now ) +COPY package.json ./ +COPY pnpm-lock.yaml ./ +COPY patches ./patches +RUN pnpm i --frozen-lockfile --ignore-scripts + +# Copy all source files +COPY . ./ + +# Run full install with every postinstall script ( This needs project file ) +RUN pnpm i --frozen-lockfile + +# Build +RUN pnpm build + +FROM base AS runner + +ARG UID=911 +ARG GID=911 + +# Create a dedicated user and group +RUN set -eux; \ + addgroup -g $UID elk; \ + adduser -u $GID -D -G elk elk; + +USER elk + +ENV NODE_ENV=production + +COPY --from=builder /elk/.output ./.output + +EXPOSE 5314/tcp + +ENV PORT=5314 + +# Specify container only environment variables ( can be overwritten by runtime env ) +ENV NUXT_STORAGE_FS_BASE='/elk/data' + +# Persistent storage data +VOLUME [ "/elk/data" ] + +CMD ["node", ".output/server/index.mjs"] diff --git a/README.md b/README.md index 013c1665..7fb26c97 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,55 @@ -# Elk -*A nimble Mastodon web client* -

- Elk logo + Elk logo

+ +

Elk alpha

+ +

+A nimble Mastodon web client +

+

discord chat Start new PR in StackBlitz Codeflow + Open board on Volta


-# Elk is in early alpha ⚠️ +

+ + Elk screenshots + +

-It is already quite usable, but it isn't ready for wide adoption yet. We recommend you to use it if you would like to help us build it. We appreciate your feedback and contributions. Check out the [Open Issues](https://github.com/elk-zone/elk/issues) and jump in the action. Join the [Elk discord server](https://chat.elk.zone) to chat with us and learn more about the project. +## ⚠️ Elk is in Alpha -The client is deployed on: +It is already quite usable, but it isn't ready for wide adoption yet. We recommend you use it if you would like to help us build it. We appreciate your feedback and contributions. Check out the [Open Issues](https://github.com/elk-zone/elk/issues) and jump in the action. Join the [Elk discord server](https://chat.elk.zone) to chat with us and learn more about the project. + +## Deployment + +### Official Deployment + +The Elk team maintains a deployment at: - 🦌 Production: [elk.zone](https://elk.zone) - 🐙 Canary: [main.elk.zone](https://main.elk.zone) (deploys on every commit to `main` branch) -You can share screenshots on social media but we prefer you avoid sharing this URL directly until the app is more polished. Feel free to share the URL with your friends and invite others you think could be interested in helping to improve Elk. +### Ecosystem -## Sponsors +These are known deployments using Elk as an alternative Web client for Mastodon servers or as a base for other projects in the fediverse: -We want to thanks the generous sponsoring and help of: +- [elk.h4.io](https://elk.h4.io) - Use Elk for the `h4.io` Server +- [elk.universeodon.com](https://elk.universeodon.com) - Use Elk for the Universeodon Server +- [elk.vmst.io](https://elk.vmst.io) - Use Elk for the `vmst.io` Server + +> **Note**: Community deployments are **NOT** maintained by the Elk team. It may not be synced with Elk's source code. Please do your own research about the host servers before using them. + +## 💖 Sponsors + +We are grateful for the generous sponsorship and help of: NuxtLabs @@ -37,7 +60,11 @@ We want to thanks the generous sponsoring and help of:

-And all the companies and individuals sponsoring Elk Team members. If you're enjoying the app, consider sponsoring our team: +And all the companies and individuals sponsoring Elk Team and the members. If you're enjoying the app, consider sponsoring us: + +- [Elk Team's GitHub Sponsors](https://github.com/sponsors/elk-zone) + +Or you can sponsor our core team members individually: - [Anthony Fu](https://github.com/sponsors/antfu) - [Daniel Roe](https://github.com/sponsors/danielroe) @@ -46,11 +73,11 @@ And all the companies and individuals sponsoring Elk Team members. If you're enj We would also appreciate sponsoring other contributors to the Elk project. If someone helps you solve an issue or implement a feature you wanted, supporting them would help make this project and OS more sustainable. -## Roadmap +## 📍 Roadmap [Open board on Volta](https://volta.net/elk-zone/elk) -## Contributing +## 🧑‍💻 Contributing We're really excited that you're interested in contributing to Elk! Before submitting your contribution, please read through the following guide. @@ -86,7 +113,7 @@ Elk uses [Vitest](https://vitest.dev). You can run the test suite with: nr test ``` -## Stack +## 🦄 Stack - [Vite](https://vitejs.dev/) - Next Generation Frontend Tooling - [Nuxt](https://nuxt.com/) - The Intuitive Web Framework @@ -100,6 +127,12 @@ nr test - [shiki](https://shiki.matsu.io/) - A beautiful Syntax Highlighter - [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update and push notifications -## License +## 👨‍💻 Contributors + + + + + +## 📄 License [MIT](./LICENSE) © 2022-PRESENT Elk contributors diff --git a/app.vue b/app.vue index 31cc43a1..3ce0a951 100644 --- a/app.vue +++ b/app.vue @@ -2,6 +2,16 @@ setupPageHeader() provideGlobalCommands() +const route = useRoute() + +if (process.server && !route.path.startsWith('/settings')) { + useHead({ + meta: [ + { property: 'og:url', content: `https://elk.zone${route.path}` }, + ], + }) +} + // We want to trigger rerendering the page when account changes const key = computed(() => `${currentUser.value?.server ?? currentServer.value}:${currentUser.value?.account.id || ''}`) diff --git a/components/account/AccountAvatar.vue b/components/account/AccountAvatar.vue index 4a4c50aa..26953d8d 100644 --- a/components/account/AccountAvatar.vue +++ b/components/account/AccountAvatar.vue @@ -15,9 +15,11 @@ const error = $ref(false) :key="account.avatar" width="400" height="400" - :src="error ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar" + select-none + :src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar" :alt="$t('account.avatar_description', [account.username])" loading="lazy" + class="account-avatar" :class="(loaded ? 'bg-base' : 'bg-gray:10') + (square ? ' ' : ' rounded-full')" :style="{ 'clip-path': square ? `url(#avatar-mask)` : 'none' }" v-bind="$attrs" diff --git a/components/account/AccountFollowButton.vue b/components/account/AccountFollowButton.vue index 5a39eaa0..7aab0fd9 100644 --- a/components/account/AccountFollowButton.vue +++ b/components/account/AccountFollowButton.vue @@ -8,18 +8,28 @@ const { account, command, context, ...props } = defineProps<{ command?: boolean }>() -const isSelf = $computed(() => currentUser.value?.account.id === account.id) +const { t } = useI18n() +const isSelf = $(useSelfAccount(() => account)) const enable = $computed(() => !isSelf && currentUser.value) const relationship = $computed(() => props.relationship || useRelationship(account).value) -const masto = useMasto() +const { client } = $(useMasto()) async function toggleFollow() { + if (relationship!.following) { + if (await openConfirmDialog({ + title: t('confirm.unfollow.title'), + confirm: t('confirm.unfollow.confirm'), + cancel: t('confirm.unfollow.cancel'), + }) !== 'confirm') + return + } relationship!.following = !relationship!.following try { - const newRel = await masto.v1.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id) + const newRel = await client.v1.accounts[relationship!.following ? 'follow' : 'unfollow'](account.id) Object.assign(relationship!, newRel) } - catch { + catch (err) { + console.error(err) // TODO error handling relationship!.following = !relationship!.following } @@ -28,10 +38,11 @@ async function toggleFollow() { async function unblock() { relationship!.blocking = false try { - const newRel = await masto.v1.accounts.unblock(account.id) + const newRel = await client.v1.accounts.unblock(account.id) Object.assign(relationship!, newRel) } - catch { + catch (err) { + console.error(err) // TODO error handling relationship!.blocking = true } @@ -40,17 +51,16 @@ async function unblock() { async function unmute() { relationship!.muting = false try { - const newRel = await masto.v1.accounts.unmute(account.id) + const newRel = await client.v1.accounts.unmute(account.id) Object.assign(relationship!, newRel) } - catch { + catch (err) { + console.error(err) // TODO error handling relationship!.muting = true } } -const { t } = useI18n() - useCommand({ scope: 'Actions', order: -2, diff --git a/components/account/AccountHandle.vue b/components/account/AccountHandle.vue index 63465d0a..c2a955c5 100644 --- a/components/account/AccountHandle.vue +++ b/components/account/AccountHandle.vue @@ -9,7 +9,7 @@ const serverName = $computed(() => getServerName(account))