commit working state

This commit is contained in:
2024-04-15 11:38:40 +02:00
parent 89f3f86c54
commit 508258bf0f
33 changed files with 1130 additions and 221 deletions
+12 -1
View File
@@ -14,6 +14,17 @@ function constructAPIUrl(endpoint:string){
const { schema, host, port, basepath } = getAPIEnv();
return `${schema}://${host}:${port}/${basepath}/${endpoint}`
}
function constructUrl(endpoint:string){
const { schema, host, port, basepath } = getAPIEnv();
return `${schema}://${host}:${port}/${endpoint}`
}
function truncateString(str:string = '', num:number = 255) {
if (str.length > num) {
return str.slice(0, num) + "...";
} else {
return str;
}
}
export { Gens, Auth, constructAPIUrl }
export { Gens, Auth, constructAPIUrl, constructUrl, truncateString }
+9
View File
@@ -0,0 +1,9 @@
export function parseSetCookie(h: string[]) {
let aaa = h.map(
s => [...s.matchAll(/(.*?)=(.*?)($|;|,(?! ))/gm)]
);
const dict = Object.assign({}, ...aaa[0].map((e) => {
return { [e[1]]: decodeURIComponent(e[2]) };
}));
return dict;
}