commit working state
This commit is contained in:
+12
-1
@@ -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 }
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user