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/CONTRIBUTING.md b/CONTRIBUTING.md index e68e4e73..1d6ec35a 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,18 +18,33 @@ 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 diff --git a/README.md b/README.md index 013c1665..f88a9bd8 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,15 @@ -# Elk -*A nimble Mastodon web client* -

- Elk logo + Elk logo

+ +

Elk alpha

+ +

+A nimble Mastodon web client +

+

discord chat @@ -13,9 +17,15 @@


-# 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 + +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. The client is deployed on: @@ -24,9 +34,9 @@ The client is deployed on: 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. -## Sponsors +## 💖 Sponsors -We want to thanks the generous sponsoring and help of: +We are grateful for the generous sponsorship and help of: NuxtLabs @@ -37,7 +47,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 +60,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 +100,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 +114,6 @@ 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 +## 📄 License [MIT](./LICENSE) © 2022-PRESENT Elk contributors diff --git a/app.vue b/app.vue index 31cc43a1..bdc7c1b0 100644 --- a/app.vue +++ b/app.vue @@ -2,6 +2,15 @@ setupPageHeader() provideGlobalCommands() +const route = useRoute() +if (process.server && !route.path.startsWith('/settings')) { + useHead({ + meta: [ + { property: 'og:url', content: `https://main.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/nav/NavFooter.vue b/components/nav/NavFooter.vue index a14a72f6..4da9a96c 100644 --- a/components/nav/NavFooter.vue +++ b/components/nav/NavFooter.vue @@ -26,6 +26,16 @@ function toggleDark() { @click="userSettings.zenMode = !userSettings.zenMode" /> + + +
diff --git a/components/settings/SettingsItem.vue b/components/settings/SettingsItem.vue index cda8029b..59b62882 100644 --- a/components/settings/SettingsItem.vue +++ b/components/settings/SettingsItem.vue @@ -62,7 +62,7 @@ useCommand({ />
-
+

{{ text }} diff --git a/components/settings/SettingsSponsorsList.vue b/components/settings/SettingsSponsorsList.vue new file mode 100644 index 00000000..4f7de041 --- /dev/null +++ b/components/settings/SettingsSponsorsList.vue @@ -0,0 +1,31 @@ + diff --git a/composables/content-parse.ts b/composables/content-parse.ts index dea3d5b2..845cdb09 100644 --- a/composables/content-parse.ts +++ b/composables/content-parse.ts @@ -55,7 +55,10 @@ export function parseMastodonHTML( // Handle code blocks html = html .replace(/>(```|~~~)(\w*)([\s\S]+?)\1/g, (_1, _2, lang: string, raw: string) => { - const code = htmlToText(raw).replace(//g, '>') + const code = htmlToText(raw) + .replace(//g, '>') + .replace(/`/, '`') const classes = lang ? ` class="language-${lang}"` : '' return `>

${code}
` }) diff --git a/composables/vue.ts b/composables/vue.ts index 1c3224da..3c3a99c2 100644 --- a/composables/vue.ts +++ b/composables/vue.ts @@ -37,6 +37,20 @@ export function onReactivated(hook: Function, target?: ComponentInternalInstance // TODO: Workaround for Nuxt bug: https://github.com/elk-zone/elk/pull/199#issuecomment-1329771961 export function useHeadFixed(input: UseHeadInput, options?: HeadEntryOptions): ActiveHeadEntry> | void { const deactivated = useDeactivated() + if (input && typeof input === 'object' && !('value' in input)) { + const title = 'title' in input ? input.title : undefined + if (process.server && title) { + input.meta = input.meta || [] + if (Array.isArray(input.meta)) { + input.meta.push( + { property: 'og:title', content: (typeof input.title === 'function' ? input.title() : input.title) as string }, + ) + } + } + else if (title) { + (input as any).title = () => isHydrated.value ? typeof title === 'function' ? title() : title : '' + } + } return useHead(() => { if (deactivated.value) return {} diff --git a/locales/en-US.json b/locales/en-US.json index a4b372ff..0e5b1580 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -236,7 +236,13 @@ "settings": { "about": { "label": "About", - "meet_the_team": "Meet the team" + "meet_the_team": "Meet the team", + "sponsor_action": "Sponsor us", + "sponsor_action_desc": "To support the team developing Elk", + "sponsors": "Sponsors", + "sponsors_body_1": "Elk is made possible thanks the generous sponsoring and help of:", + "sponsors_body_2": "And all the companies and individuals sponsoring Elk Team and the members.", + "sponsors_body_3": "If you're enjoying the app, consider sponsoring us:" }, "account_settings": { "description": "Edit your account settings in Mastodon UI", diff --git a/modules/tauri/runtime/nitro.client.ts b/modules/tauri/runtime/nitro.client.ts index 0694fc56..3c31db13 100644 --- a/modules/tauri/runtime/nitro.client.ts +++ b/modules/tauri/runtime/nitro.client.ts @@ -5,7 +5,6 @@ import { toNodeListener, } from 'h3' import { createFetch } from 'ofetch' -import { parseURL } from 'ufo' import { createCall, createFetch as createLocalFetch, @@ -26,13 +25,10 @@ const handlers = [ }, ] -const { protocol, host } = parseURL(window.location.href) - // @ts-expect-error undeclared global window property window.__NUXT__.config = { // @ts-expect-error undeclared global window property ...window.__NUXT__.config, - deployUrl: `${protocol}//${host}`, storage: {}, } diff --git a/nuxt.config.ts b/nuxt.config.ts index 9d1ed396..6faeda88 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -71,25 +71,11 @@ export default defineNuxtConfig({ }, }, runtimeConfig: { - deployUrl: !isCI - ? 'http://localhost:5314' - : isPreview - ? process.env.DEPLOY_PRIME_URL - : 'https://elk.zone', cloudflare: { accountId: '', namespaceId: '', apiToken: '', }, - discord: { - inviteUrl: 'https://chat.elk.zone', - }, - github: { - // oauth flow - clientId: '', - clientSecret: '', - inviteToken: '', - }, public: { env: '', // set in build-env module buildInfo: {} as BuildInfo, // set in build-env module @@ -132,6 +118,16 @@ export default defineNuxtConfig({ ], meta: [ { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }, + // open graph social image + { property: 'og:title', content: 'Elk' }, + { property: 'og:description', content: 'A nimble Mastodon web client' }, + { property: 'og:type', content: 'website' }, + { property: 'og:image', content: 'https://main.elk.zone/elk-og.png' }, + { property: 'og:image:width', content: '3800' }, + { property: 'og:image:height', content: '1900' }, + { property: 'og:site_name', content: 'Elk' }, + { property: 'twitter:site', content: '@elk_zone' }, + { property: 'twitter:card', content: 'summary_large_image' }, ], }, }, diff --git a/pages/[[server]]/explore/index.vue b/pages/[[server]]/explore/index.vue index 28088b7b..aee8806d 100644 --- a/pages/[[server]]/explore/index.vue +++ b/pages/[[server]]/explore/index.vue @@ -8,7 +8,7 @@ const paginator = useMasto().v1.trends.listStatuses() const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_POSTS_TIPS, false) useHeadFixed({ - title: () => isHydrated.value ? `${t('tab.posts')} | ${t('nav.explore')}` : '', + title: () => `${t('tab.posts')} | ${t('nav.explore')}`, }) diff --git a/pages/[[server]]/explore/links.vue b/pages/[[server]]/explore/links.vue index af8deb96..55f8be76 100644 --- a/pages/[[server]]/explore/links.vue +++ b/pages/[[server]]/explore/links.vue @@ -8,7 +8,7 @@ const paginator = useMasto().v1.trends.listLinks() const hideNewsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_NEWS_TIPS, false) useHeadFixed({ - title: () => isHydrated.value ? `${t('tab.news')} | ${t('nav.explore')}` : '', + title: () => `${t('tab.news')} | ${t('nav.explore')}`, }) diff --git a/pages/[[server]]/explore/tags.vue b/pages/[[server]]/explore/tags.vue index 6edbb0aa..f69447f5 100644 --- a/pages/[[server]]/explore/tags.vue +++ b/pages/[[server]]/explore/tags.vue @@ -11,7 +11,7 @@ const paginator = masto.v1.trends.listTags({ const hideTagsTips = useLocalStorage(STORAGE_KEY_HIDE_EXPLORE_TAGS_TIPS, false) useHeadFixed({ - title: () => isHydrated.value ? `${t('tab.hashtags')} | ${t('nav.explore')}` : '', + title: () => `${t('tab.hashtags')} | ${t('nav.explore')}`, }) diff --git a/pages/[[server]]/explore/users.vue b/pages/[[server]]/explore/users.vue index 7fec975d..218d5964 100644 --- a/pages/[[server]]/explore/users.vue +++ b/pages/[[server]]/explore/users.vue @@ -5,7 +5,7 @@ const { t } = useI18n() const paginator = useMasto().v2.suggestions.list({ limit: 20 }) useHeadFixed({ - title: () => isHydrated.value ? `${t('tab.for_you')} | ${t('nav.explore')}` : '', + title: () => `${t('tab.for_you')} | ${t('nav.explore')}`, }) diff --git a/pages/notifications/index.vue b/pages/notifications/index.vue index 6baa336c..392f9bad 100644 --- a/pages/notifications/index.vue +++ b/pages/notifications/index.vue @@ -1,7 +1,7 @@ diff --git a/pages/notifications/mention.vue b/pages/notifications/mention.vue index 3c3ea858..110af1b7 100644 --- a/pages/notifications/mention.vue +++ b/pages/notifications/mention.vue @@ -1,7 +1,7 @@ diff --git a/pages/settings/about/index.vue b/pages/settings/about/index.vue index 5651dee5..a4eb67f2 100644 --- a/pages/settings/about/index.vue +++ b/pages/settings/about/index.vue @@ -54,7 +54,7 @@ const handleShowCommit = () => { @@ -62,27 +62,58 @@ const handleShowCommit = () => { text="Mastodon" icon="i-ri:mastodon-line" to="/m.webtoo.ls/@elk" - external target="_blank" + external large target="_blank" />
+

+ {{ $t('settings.about.sponsors') }} +

+ +

+ {{ $t('settings.about.sponsors_body_1') }} +

+ + + +

+ {{ $t('settings.about.sponsors_body_2') }} +

+

+ {{ $t('settings.about.sponsors_body_3') }} +

+ + + + + +
+