mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 00:23:02 -04:00
plugins(fixfileExtensions): organize
This commit is contained in:
parent
118e8387db
commit
fda023d503
3 changed files with 14 additions and 16 deletions
12
src/equicordplugins/fixFileExtensions/components.tsx
Normal file
12
src/equicordplugins/fixFileExtensions/components.tsx
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
const extensionMap = {
|
||||||
|
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
|
||||||
|
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],
|
||||||
|
"svg": [".svgz"],
|
||||||
|
"mp4": [".m4v", ".m4a", ".m4r", ".m4b", ".m4p"],
|
||||||
|
"mov": [".movie", ".qt"],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const reverseExtensionMap = Object.entries(extensionMap).reduce((acc, [target, exts]) => {
|
||||||
|
exts.forEach(ext => acc[ext] = `.${target}`);
|
||||||
|
return acc;
|
||||||
|
}, {} as Record<string, string>);
|
|
@ -6,7 +6,8 @@
|
||||||
|
|
||||||
import { Upload } from "@api/MessageEvents";
|
import { Upload } from "@api/MessageEvents";
|
||||||
import { Settings } from "@api/Settings";
|
import { Settings } from "@api/Settings";
|
||||||
import { EquicordDevs, reverseExtensionMap } from "@utils/constants";
|
import { EquicordDevs } from "@utils/constants";
|
||||||
|
import { reverseExtensionMap } from "./components";
|
||||||
import definePlugin from "@utils/types";
|
import definePlugin from "@utils/types";
|
||||||
|
|
||||||
type ExtUpload = Upload & { fixExtension?: boolean; };
|
type ExtUpload = Upload & { fixExtension?: boolean; };
|
||||||
|
|
|
@ -31,21 +31,6 @@ export interface Dev {
|
||||||
badge?: boolean;
|
badge?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No clue where to put these
|
|
||||||
const extensionMap = {
|
|
||||||
"ogg": [".ogv", ".oga", ".ogx", ".ogm", ".spx", ".opus"],
|
|
||||||
"jpg": [".jpg", ".jpeg", ".jfif", ".jpe", ".jif", ".jfi", ".pjpeg", ".pjp"],
|
|
||||||
"svg": [".svgz"],
|
|
||||||
"mp4": [".m4v", ".m4a", ".m4r", ".m4b", ".m4p"],
|
|
||||||
"mov": [".movie", ".qt"],
|
|
||||||
};
|
|
||||||
|
|
||||||
export const reverseExtensionMap = Object.entries(extensionMap).reduce((acc, [target, exts]) => {
|
|
||||||
exts.forEach(ext => acc[ext] = `.${target}`);
|
|
||||||
return acc;
|
|
||||||
}, {} as Record<string, string>);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you made a plugin or substantial contribution, add yourself here.
|
* If you made a plugin or substantial contribution, add yourself here.
|
||||||
* This object is used for the plugin author list, as well as to add a contributor badge to your profile.
|
* This object is used for the plugin author list, as well as to add a contributor badge to your profile.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue