feat(server): support selfhost licenses (#8947)

This commit is contained in:
forehalo
2025-01-22 10:21:07 +00:00
parent 22e424d7de
commit 994d758c07
31 changed files with 1653 additions and 127 deletions
@@ -46,6 +46,24 @@ export class URLHelper {
return new URLSearchParams(query).toString();
}
addSimpleQuery(
url: string,
key: string,
value: string | number | boolean,
escape = true
) {
const urlObj = new URL(url);
if (escape) {
urlObj.searchParams.set(key, encodeURIComponent(value));
return urlObj.toString();
} else {
const query =
(urlObj.search ? urlObj.search + '&' : '?') + `${key}=${value}`;
return urlObj.origin + urlObj.pathname + query;
}
}
url(path: string, query: Record<string, any> = {}) {
const url = new URL(path, this.origin);