mirror of
https://github.com/versia-pub/server.git
synced 2025-12-07 16:58:20 +01:00
Fixes for different base_url and bind url
This commit is contained in:
parent
8ec34f7138
commit
27260dff68
|
|
@ -50,10 +50,6 @@ export default defineNuxtConfig({
|
|||
titleSeparator: "·",
|
||||
siteName: "Lysand",
|
||||
trailingSlash: true,
|
||||
// @ts-ignore
|
||||
|
||||
url2: async () => await Promise.resolve("cheese"),
|
||||
//url: `${config?.http.bind}:${config?.http.bind_port}`,
|
||||
},
|
||||
},
|
||||
site: {
|
||||
|
|
|
|||
|
|
@ -22,8 +22,10 @@ if (!config) {
|
|||
|
||||
const route = useRoute();
|
||||
|
||||
const url = process.client ? config.http.base_url : config.http.url;
|
||||
|
||||
const data = await fetch(
|
||||
new URL(`/api/v1/statuses/${route.params.uuid}`, config.http.url),
|
||||
new URL(`/api/v1/statuses/${route.params.uuid}`, url),
|
||||
{
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
|
|
|
|||
|
|
@ -22,30 +22,26 @@ if (!config) {
|
|||
|
||||
const route = useRoute();
|
||||
|
||||
const url = process.client ? config.http.base_url : config.http.url;
|
||||
|
||||
const username = (route.params.username as string).replace("@", "");
|
||||
|
||||
const id = await fetch(
|
||||
new URL(`/api/v1/accounts/search?q=${username}`, config.http.url),
|
||||
{
|
||||
const id = await fetch(new URL(`/api/v1/accounts/search?q=${username}`, url), {
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
},
|
||||
)
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.catch(() => null);
|
||||
|
||||
let data = null;
|
||||
|
||||
if (id && id.length > 0) {
|
||||
data = await fetch(
|
||||
new URL(`/api/v1/accounts/${id[0].id}`, config.http.url),
|
||||
{
|
||||
data = await fetch(new URL(`/api/v1/accounts/${id[0].id}`, url), {
|
||||
headers: {
|
||||
Accept: "application/json",
|
||||
},
|
||||
},
|
||||
)
|
||||
})
|
||||
.then((res) => res.json())
|
||||
.catch(() => ({
|
||||
error: "Failed to fetch user (it probably doesn't exist)",
|
||||
|
|
|
|||
|
|
@ -107,9 +107,11 @@ if (!config) {
|
|||
throw new Error("Config not found");
|
||||
}
|
||||
|
||||
const instanceInfo = (await fetch(
|
||||
new URL("/api/v1/instance", config.http.url),
|
||||
).then((data) => data.json())) as APIInstance & {
|
||||
const url = process.client ? config.http.base_url : config.http.url;
|
||||
|
||||
const instanceInfo = (await fetch(new URL("/api/v1/instance", url)).then(
|
||||
(data) => data.json(),
|
||||
)) as APIInstance & {
|
||||
tos_url: string;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue