diff --git a/.env.example b/.env.example index 7f682ca8..9b0ba49a 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ NUXT_PUBLIC_TRANSLATE_API= NUXT_PUBLIC_DEFAULT_SERVER= -SINGLE_INSTANCE_SERVER= +NUXT_PUBLIC_SINGLE_INSTANCE= NUXT_PUBLIC_PRIVACY_POLICY_URL= # Production only diff --git a/.eslintignore b/.eslintignore index b2365300..d652cf4e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,3 +9,5 @@ public/ https-dev-config/localhost.crt https-dev-config/localhost.key Dockerfile +elk-translation-status.json +docs/translation-status.json diff --git a/.gitignore b/.gitignore index 72b234fa..a7cd793f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ dist .vite-inspect .netlify/ .eslintcache +elk-translation-status.json public/shiki public/emojis diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..0828ab79 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v18 \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index f1855fcb..4b6c677a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -22,7 +22,7 @@ ], "i18n-ally.preferredDelimiter": "_", "i18n-ally.sortKeys": true, - "i18n-ally.sourceLanguage": "en-US", + "i18n-ally.sourceLanguage": "en", "prettier.enable": false, "volar.completion.preferredTagNameCase": "pascal", "volar.completion.preferredAttrNameCase": "kebab" diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..160e3b39 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,45 @@ +# Code Of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team by DM at [the Elk Discord](https://chat.elk.zone). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a2bae242..7a447093 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,9 +1,11 @@ # Contributing Guide -Hi! We are really excited that you are interested in contributing to Elk. Before submitting your contribution, please make sure to take a moment and read through the following guide. +Hi! We are excited that you are interested in contributing to Elk. Before submitting your contribution, please make sure to take a moment and read through the following guide. Refer also to https://github.com/antfu/contribute. +For guidelines on contributing to the documentation, refer to the [docs README](./docs/README.md). + ### Online 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). @@ -16,7 +18,9 @@ To develop and test the Elk package: 1. Fork the Elk repository to your own GitHub account and then clone it to your local device. -2. Ensure using the latest Node.js (16.x) +2. Ensure using the latest Node.js (16.x). +If you have [nvm](https://github.com/nvm-sh/nvm), you can run `nvm i` to install the required version. + 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) @@ -50,16 +54,16 @@ nr test 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. +You should test the Elk PWA application on private browsing mode on any Chromium-based browser: will not work on Firefox and Safari. If not using private browsing mode, you will need to uninstall the PWA application from your browser once you finish testing: - Open `Dev Tools` (`Option + ⌘ + J` on macOS, `Shift + CTRL + J` on Windows/Linux) -- Go to `Application > Storage`, you should check following checkboxes: +- Go to `Application > Storage`, you should check the following checkboxes: - Application: [x] Unregister service worker - Storage: [x] IndexedDB and [x] Local and session storage - Cache: [x] Cache storage and [x] Application cache - Click on `Clear site data` button -- Go to `Application > Service Workers` and check the current `service worker` is missing or has the state `deleted` or `redundant` +- Go to `Application > Service Workers` and check if the current `service worker` is missing or has the state `deleted` or `redundant` ## CI errors @@ -78,23 +82,30 @@ Elk supports `right-to-left` languages, we need to make sure that the UI is work Simple approach used by most websites of relying on direction set in HTML element does not work because direction for various items, such as timeline, does not always match direction set in HTML. We've added some `UnoCSS` utilities styles to help you with that: -- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. Same rules applies for margin. +- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. The same rules apply to margin. - Do not use `rtl-` classes, such as `rtl-left-0`. -- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception from rule above. For icons inside timeline it might not work as expected. +- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception from the rule above. For icons inside the timeline, it might not work as expected. - For absolute positioned elements, don't use `left/right`: for example `left-0`. Use `inset-inline-start/end` instead. `UnoCSS` shortcuts are `inset-is` for `inset-inline-start` and `inset-ie` for `inset-inline-end`. Example: `left-0` should be replaced with `inset-is-0`. -- If you need to change border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`. -- If you need to change border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`. +- If you need to change the border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`. +- If you need to change the border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`. ## Internationalization -We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://i18n.nuxtjs.org/) to handle internationalization. +We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://v8.i18n.nuxtjs.org/) to handle internationalization. + +You can check the current [translation status](https://docs.elk.zone/docs/guide/contributing#translation-status): more instructions on the table caption. + +If you are updating a translation in your local environment, you can run the following commands to check the status: +- from root folder: `nr prepare-translation-status` +- change to `docs` folder and run docs dev server `nr dev` +- open `http://localhost:3000/docs/guide/contributing#translation-status` in your browser ### 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#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) + - If your language has 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 @@ -109,7 +120,7 @@ Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essential ### Messages interpolation -Most of the messages used in Elk do not require any interpolation, however, there are some messages that require interpolation: check [Message Format Syntax](https://vue-i18n.intlify.dev/guide/essentials/syntax.html) for more info. +Most of the messages used in Elk do not require any interpolation, however, some messages require interpolation: check [Message Format Syntax](https://vue-i18n.intlify.dev/guide/essentials/syntax.html) for more info. We're using these types of interpolation: - [List interpolation](https://vue-i18n.intlify.dev/guide/essentials/syntax.html#list-interpolation) @@ -131,7 +142,7 @@ Check [Custom Plural Number Formatting Entries](#custom-plural-number-formatting When using plural number formatting, we'll have always `{n}` available in the message, for example, `You have {n} new notifications|You have {n} new notification|You have {n} new notifications` or `You have no new notifications|You have 1 new notification|You have {n} new notifications`. -We've included `v` named parameter, it will be used to pass the formatted number using [Intl.NumberFormat::format](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/format): will be the number with separators symbols. The exception to previous rule is when we're using `plural` **with** `i18n-t` component, in this case, we'll need to use `{0}` instead `{v}` to access the number. +We've included `v` named parameter, it will be used to pass the formatted number using [Intl.NumberFormat::format](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/format): will be the number with separators symbols. The exception to the previous rule is when we're using `plural` **with** `i18n-t` component, in this case, we'll need to use `{0}` instead `{v}` to access the number. Additionally, Elk will use [compact notation for numbers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#parameters) for some entries, check `notation` and `compactDisplay` options: for example, `1K` for `1000`, `1M` for `1000000`, `1B` for `1000000000` and so on. That entry will be available in the message using `{v}` named parameter (or `{0}` if using the message **with** `i18n-t` component). diff --git a/Dockerfile b/Dockerfile index 389fef03..172e08d9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,8 @@ ARG GID=911 # Create a dedicated user and group RUN set -eux; \ - addgroup -g $UID elk; \ - adduser -u $GID -D -G elk elk; + addgroup -g $GID elk; \ + adduser -u $UID -D -G elk elk; USER elk diff --git a/README.md b/README.md index 82bbf1e7..f62c383c 100644 --- a/README.md +++ b/README.md @@ -37,10 +37,26 @@ 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) +### Self-Host Docker Deployment + +In order to host Elk yourself you can use the provided Dockerfile to build a container with elk. Be aware, that Elk only loads properly of the connection is done via SSL/TLS. The Docker container itself does not provide any SSL/TLS handling. You'll have to add this bit yourself. +One could put Elk behind popular reverse proxies with SSL Handling like Traefik, NGINX etc. + +1. checkout source ```git clone https://github.com/elk-zone/elk.git``` +1. got into new source dir: ```cd elk``` +1. build Docker image: ```docker build .``` +1. create local storage directory for settings: ```mkdir elk-storage``` +1. adjust permissions of storage dir: ```sudo chown 911:911 ./elk-storage``` +1. start container: ```docker-compose up -d``` + +Note: The provided Dockerfile creates a container which will eventually run Elk as non-root user and create a persistent named Docker volume upon first start (if that volume does not yet exist). This volume is always created with root permission. Failing to change the permissions of ```/elk/data``` inside this volume to UID:GID 911 (as specified for Elk in the Dockerfile) will prevent Elk from storing it's config for user accounts. You either have to fix the permission in the created named volume, or mount a directory with the correct permission to ```/elk/data``` into the container. + + ### Ecosystem These are known deployments using Elk as an alternative Web client for Mastodon servers or as a base for other projects in the fediverse: +- [elk.fedified.com](https://elk.fedified.com) - Use Elk to log into any compatible instance - [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 @@ -117,6 +133,10 @@ Elk uses [Vitest](https://vitest.dev). You can run the test suite with: nr test ``` +## 📲 PWA + +You can consult the [PWA documentation](https://docs.elk.zone/docs/pwa) to learn more about the PWA capabilities on Elk, how to install Elk PWA in your desktop or mobile device and some hints about PWA stuff on Elk. + ## 🦄 Stack - [Vite](https://vitejs.dev/) - Next Generation Frontend Tooling @@ -129,7 +149,7 @@ nr test - [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format - [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript - [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 +- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update, Web Push Notifications and Web Share Target API ## 👨‍💻 Contributors diff --git a/components/account/AccountBotIndicator.vue b/components/account/AccountBotIndicator.vue index 9dd3a93a..d4409539 100644 --- a/components/account/AccountBotIndicator.vue +++ b/components/account/AccountBotIndicator.vue @@ -11,7 +11,7 @@ defineProps<{ text-secondary-light > - +
diff --git a/components/common/CommonBlurhash.vue b/components/common/CommonBlurhash.vue index 89624d49..11f3c95f 100644 --- a/components/common/CommonBlurhash.vue +++ b/components/common/CommonBlurhash.vue @@ -1,10 +1,11 @@ diff --git a/components/common/CommonInputImage.vue b/components/common/CommonInputImage.vue index 4a002ed2..947cb284 100644 --- a/components/common/CommonInputImage.vue +++ b/components/common/CommonInputImage.vue @@ -35,6 +35,8 @@ const previewImage = ref('') const imageSrc = computed(() => previewImage.value || defaultImage.value) const pickImage = async () => { + if (process.server) + return const image = await fileOpen({ description: 'Image', mimeTypes: props.allowedFileTypes, diff --git a/components/common/CommonPreviewPrompt.vue b/components/common/CommonPreviewPrompt.vue index d6df37db..3b86c123 100644 --- a/components/common/CommonPreviewPrompt.vue +++ b/components/common/CommonPreviewPrompt.vue @@ -14,7 +14,7 @@ const build = useBuildInfo()

- {{ build.commit.slice(0, 7) }} + {{ build.shortCommit }}

diff --git a/components/common/CommonRouteTabs.vue b/components/common/CommonRouteTabs.vue index b0b455d2..a2b453a7 100644 --- a/components/common/CommonRouteTabs.vue +++ b/components/common/CommonRouteTabs.vue @@ -29,7 +29,7 @@ useCommands(() => command