diff --git a/README.md b/README.md index 03a01bd..50911f8 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,8 @@ services: - lysand-net environment: NUXT_PUBLIC_API_HOST: https://yourserver.com + # For Tor users, set the following environment variable in addition to the above + # NUXT_PUBLIC_ONION_API_HOST: http://youronionserver.onion ``` Then, the frontend will be available at `http://localhost:3000` inside the container. To link it to a Lysand Server, set the `NUXT_PUBLIC_API_HOST` environment variable to the server's URL. diff --git a/composables/BaseUrl.ts b/composables/BaseUrl.ts index 6a3b692..ffa54e9 100644 --- a/composables/BaseUrl.ts +++ b/composables/BaseUrl.ts @@ -1,3 +1,10 @@ export const useBaseUrl = () => { + // Check if running on Onion URL + if (useRequestURL().hostname.endsWith(".onion")) { + return ref( + useRuntimeConfig().public.onionApiHost ?? useRequestURL().origin, + ); + } + return ref(useRuntimeConfig().public.apiHost ?? useRequestURL().origin); }; diff --git a/nuxt.config.ts b/nuxt.config.ts index b80d418..ea4e837 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -616,6 +616,7 @@ export default defineNuxtConfig({ siteName: "Lysand", trailingSlash: true, apiHost: "https://social.lysand.org", + onionApiHost: undefined, }, }, imports: {