remove unused eslint plugin, run eslint --fix, rollback node memory workaround in ci

This commit is contained in:
Aine
2025-04-05 21:37:31 +03:00
parent 738685c599
commit bac962c127
62 changed files with 1782 additions and 1502 deletions

View File

@@ -20,15 +20,15 @@ let config: Config = {
corsCredentials: "same-origin",
asManagedUsers: [],
menu: [],
etkeccAdmin: ""
etkeccAdmin: "",
};
export const FetchConfig = async () => {
// load config.json and honor vite base url (import.meta.env.BASE_URL)
// if that url doesn't have a trailing slash - add it
let configJSONUrl = "config.json"
let configJSONUrl = "config.json";
if (import.meta.env.BASE_URL) {
configJSONUrl = `${import.meta.env.BASE_URL.replace(/\/?$/, '/')}config.json`;
configJSONUrl = `${import.meta.env.BASE_URL.replace(/\/?$/, "/")}config.json`;
}
try {
const resp = await fetch(configJSONUrl);
@@ -52,7 +52,10 @@ export const FetchConfig = async () => {
const resp = await fetch(`${protocol}://${homeserver}/.well-known/matrix/client`);
const configWK = await resp.json();
if (!configWK[WellKnownKey]) {
console.log(`Loaded ${protocol}://${homeserver}.well-known/matrix/client, but it doesn't contain ${WellKnownKey} key, skipping`, configWK);
console.log(
`Loaded ${protocol}://${homeserver}.well-known/matrix/client, but it doesn't contain ${WellKnownKey} key, skipping`,
configWK
);
} else {
console.log(`Loaded ${protocol}://${homeserver}.well-known/matrix/client`, configWK);
LoadConfig(configWK[WellKnownKey]);
@@ -61,7 +64,7 @@ export const FetchConfig = async () => {
console.log(`${protocol}://${homeserver}/.well-known/matrix/client not found, skipping`, e);
}
}
}
};
// load config from context
// we deliberately processing each key separately to avoid overwriting the whole config, loosing some keys, and messing
@@ -90,13 +93,12 @@ export const LoadConfig = (context: any) => {
if (context?.etkeccAdmin) {
config.etkeccAdmin = context.etkeccAdmin;
}
}
};
// get config
export const GetConfig = (): Config => {
return config;
}
};
// clear config
export const ClearConfig = () => {
@@ -104,4 +106,4 @@ export const ClearConfig = () => {
config = {} as Config;
// session
localStorage.clear();
}
};

View File

@@ -51,4 +51,4 @@ export const getTimeSince = (dateToCompare: string) => {
if (diffInMinutes < 30 * 24 * 60) return `${Math.floor(diffInMinutes / (7 * 24 * 60))} weeks`;
if (diffInMinutes < 60 * 24 * 60) return "1 month";
return `${Math.floor(diffInMinutes / (30 * 24 * 60))} months`;
};
};

View File

@@ -10,6 +10,6 @@ const decodeURLComponent = (str: any): any => {
} catch (e) {
return str;
}
}
};
export default decodeURLComponent;

View File

@@ -1,6 +1,6 @@
export type MatrixError = {
errcode: string;
error: string;
export interface MatrixError {
errcode: string;
error: string;
}
export const displayError = (errcode: string, status: number, message: string) => `${errcode} (${status}): ${message}`;
export const displayError = (errcode: string, status: number, message: string) => `${errcode} (${status}): ${message}`;

View File

@@ -1,12 +1,12 @@
export const getServerAndMediaIdFromMxcUrl = (mxcUrl: string): { serverName: string, mediaId: string } => {
const re = /^mxc:\/\/([^/]+)\/(\w+)/;
const ret = re.exec(mxcUrl);
if (ret == null) {
throw new Error("Invalid mxcUrl");
}
const serverName = ret[1];
const mediaId = ret[2];
return { serverName, mediaId };
export const getServerAndMediaIdFromMxcUrl = (mxcUrl: string): { serverName: string; mediaId: string } => {
const re = /^mxc:\/\/([^/]+)\/(\w+)/;
const ret = re.exec(mxcUrl);
if (ret == null) {
throw new Error("Invalid mxcUrl");
}
const serverName = ret[1];
const mediaId = ret[2];
return { serverName, mediaId };
};
export type MediaType = "thumbnail" | "original";

View File

@@ -1,13 +1,13 @@
import AnnouncementIcon from '@mui/icons-material/Announcement';
import EngineeringIcon from '@mui/icons-material/Engineering';
import HelpCenterIcon from '@mui/icons-material/HelpCenter';
import SupportAgentIcon from '@mui/icons-material/SupportAgent';
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
import PieChartIcon from '@mui/icons-material/PieChart';
import UpgradeIcon from '@mui/icons-material/Upgrade';
import RouterIcon from '@mui/icons-material/Router';
import PriceCheckIcon from '@mui/icons-material/PriceCheck';
import RestartAltIcon from '@mui/icons-material/RestartAlt';
import AnnouncementIcon from "@mui/icons-material/Announcement";
import EngineeringIcon from "@mui/icons-material/Engineering";
import HelpCenterIcon from "@mui/icons-material/HelpCenter";
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
import PieChartIcon from "@mui/icons-material/PieChart";
import PriceCheckIcon from "@mui/icons-material/PriceCheck";
import RestartAltIcon from "@mui/icons-material/RestartAlt";
import RouterIcon from "@mui/icons-material/Router";
import SupportAgentIcon from "@mui/icons-material/SupportAgent";
import UpgradeIcon from "@mui/icons-material/Upgrade";
export const Icons = {
Announcement: AnnouncementIcon,

View File

@@ -1,4 +1,5 @@
import { Identifier } from "ra-core";
import { GetConfig } from "../utils/config";
const mxidPattern = /^@[^@:]+:[^@:]+$/;
@@ -56,6 +57,6 @@ export function returnMXID(input: string | Identifier): string {
}
// If input is not a valid MXID, assume it's a localpart and construct the MXID
const localpart = typeof input === 'string' && inputStr.startsWith('@') ? inputStr.slice(1) : inputStr;
const localpart = typeof input === "string" && inputStr.startsWith("@") ? inputStr.slice(1) : inputStr;
return `@${localpart}:${homeserver}`;
}