mirror of
https://github.com/versia-pub/frontend.git
synced 2025-12-06 08:28:20 +01:00
feat: ✨ Allow specifying an Onion API host URL
This commit is contained in:
parent
b2989e898e
commit
7b13265d47
|
|
@ -75,6 +75,8 @@ services:
|
||||||
- lysand-net
|
- lysand-net
|
||||||
environment:
|
environment:
|
||||||
NUXT_PUBLIC_API_HOST: https://yourserver.com
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
export const useBaseUrl = () => {
|
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);
|
return ref(useRuntimeConfig().public.apiHost ?? useRequestURL().origin);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -616,6 +616,7 @@ export default defineNuxtConfig({
|
||||||
siteName: "Lysand",
|
siteName: "Lysand",
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
apiHost: "https://social.lysand.org",
|
apiHost: "https://social.lysand.org",
|
||||||
|
onionApiHost: undefined,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
imports: {
|
imports: {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue