FileUpload: add video proxy (#1005)
This commit is contained in:
parent
4e8e802cc7
commit
a18e75dae6
2 changed files with 8 additions and 10 deletions
|
|
@ -40,9 +40,8 @@ const litterboxOptions = [
|
|||
];
|
||||
|
||||
const embedProxyOptions = [
|
||||
{ label: "x266.mov", value: "x266", default: true },
|
||||
{ label: "discord.nfp.is", value: "nfp" },
|
||||
{ label: "embeddr.top", value: "embeddr" }
|
||||
{ label: "CORS Proxy", value: "cors", default: true },
|
||||
{ label: "discord.nfp.is", value: "nfp" }
|
||||
];
|
||||
|
||||
export const settings = definePluginSettings({
|
||||
|
|
@ -213,7 +212,7 @@ export const settings = definePluginSettings({
|
|||
type: OptionType.SELECT,
|
||||
description: "Embed helper service to wrap uploaded video links.",
|
||||
options: embedProxyOptions,
|
||||
default: "x266",
|
||||
default: "cors",
|
||||
hidden: true
|
||||
},
|
||||
corsProxyUrl: {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ function toProxyUrl(url: string): string {
|
|||
let isUploading = false;
|
||||
|
||||
type UploadPhase = "idle" | "preparing" | "uploading" | "retrying" | "success" | "failed" | "cancelled";
|
||||
type EmbedProxyService = "x266" | "nfp" | "embeddr";
|
||||
type EmbedProxyService = "cors" | "nfp";
|
||||
|
||||
export interface UploadProgressState {
|
||||
phase: UploadPhase;
|
||||
|
|
@ -699,7 +699,7 @@ const EXE_BLOCKED_SERVICES = new Set<ServiceType>([
|
|||
|
||||
function getEmbedProxyService(): EmbedProxyService {
|
||||
const service = settings.store.embedProxyService;
|
||||
return service === "nfp" || service === "embeddr" ? service : "x266"
|
||||
return service === "nfp" ? service : "cors";
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -723,13 +723,12 @@ function applyEmbedProxy(url: string): string {
|
|||
}
|
||||
|
||||
switch (service) {
|
||||
case "x266":
|
||||
return `https://x266.mov/e/${url}`;
|
||||
case "cors":
|
||||
return toProxyUrl(url);
|
||||
case "nfp":
|
||||
return `https://discord.nfp.is/?v=${encodeURIComponent(url)}`;
|
||||
case "embeddr":
|
||||
default:
|
||||
return `https://embeddr.top/${url}`;
|
||||
return toProxyUrl(url);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue