Skip to content
Permalink
36bb82cb49
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
19 lines (14 sloc) 588 Bytes
import { get } from "svelte/store";
import env, { apiURL } from "$lib/env";
import settings from "$lib/state/settings";
export const currentApiURL = () => {
const processingSettings = get(settings).processing;
const customInstanceURL = processingSettings.customInstanceURL;
if (processingSettings.enableCustomInstances && customInstanceURL.length > 0) {
return new URL(customInstanceURL).origin;
}
if (env.DEFAULT_API && processingSettings.allowDefaultOverride) {
return new URL(env.DEFAULT_API).origin;
}
return new URL(apiURL).origin;
}