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: "·",
|
titleSeparator: "·",
|
||||||
siteName: "Lysand",
|
siteName: "Lysand",
|
||||||
trailingSlash: true,
|
trailingSlash: true,
|
||||||
// @ts-ignore
|
|
||||||
|
|
||||||
url2: async () => await Promise.resolve("cheese"),
|
|
||||||
//url: `${config?.http.bind}:${config?.http.bind_port}`,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
site: {
|
site: {
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,10 @@ if (!config) {
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
const url = process.client ? config.http.base_url : config.http.url;
|
||||||
|
|
||||||
const data = await fetch(
|
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: {
|
headers: {
|
||||||
Accept: "application/json",
|
Accept: "application/json",
|
||||||
|
|
|
||||||
|
|
@ -22,30 +22,26 @@ if (!config) {
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
|
||||||
|
const url = process.client ? config.http.base_url : config.http.url;
|
||||||
|
|
||||||
const username = (route.params.username as string).replace("@", "");
|
const username = (route.params.username as string).replace("@", "");
|
||||||
|
|
||||||
const id = await fetch(
|
const id = await fetch(new URL(`/api/v1/accounts/search?q=${username}`, url), {
|
||||||
new URL(`/api/v1/accounts/search?q=${username}`, config.http.url),
|
headers: {
|
||||||
{
|
Accept: "application/json",
|
||||||
headers: {
|
|
||||||
Accept: "application/json",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
})
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.catch(() => null);
|
.catch(() => null);
|
||||||
|
|
||||||
let data = null;
|
let data = null;
|
||||||
|
|
||||||
if (id && id.length > 0) {
|
if (id && id.length > 0) {
|
||||||
data = await fetch(
|
data = await fetch(new URL(`/api/v1/accounts/${id[0].id}`, url), {
|
||||||
new URL(`/api/v1/accounts/${id[0].id}`, config.http.url),
|
headers: {
|
||||||
{
|
Accept: "application/json",
|
||||||
headers: {
|
|
||||||
Accept: "application/json",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
)
|
})
|
||||||
.then((res) => res.json())
|
.then((res) => res.json())
|
||||||
.catch(() => ({
|
.catch(() => ({
|
||||||
error: "Failed to fetch user (it probably doesn't exist)",
|
error: "Failed to fetch user (it probably doesn't exist)",
|
||||||
|
|
|
||||||
|
|
@ -107,9 +107,11 @@ if (!config) {
|
||||||
throw new Error("Config not found");
|
throw new Error("Config not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
const instanceInfo = (await fetch(
|
const url = process.client ? config.http.base_url : config.http.url;
|
||||||
new URL("/api/v1/instance", config.http.url),
|
|
||||||
).then((data) => data.json())) as APIInstance & {
|
const instanceInfo = (await fetch(new URL("/api/v1/instance", url)).then(
|
||||||
|
(data) => data.json(),
|
||||||
|
)) as APIInstance & {
|
||||||
tos_url: string;
|
tos_url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue