mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 21:45:31 +09:00
feat(desktop): bundled renderer, modules and instance accounts (#3254)
This commit is contained in:
1 parent
c748c8af4e
commit
7c5fa2180a
1275 files changed
+215074
-81246
No files matched your search
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
export const DESKTOP_LAST_ROUTE_CHANNEL = 'desktop-last-route:report';
|
||||
|
||||
const MAX_LAST_ROUTE_LENGTH = 512;
|
||||
|
||||
function containsControlCharacter(value: string): boolean {
|
||||
for (let index = 0; index < value.length; index += 1) {
|
||||
const code = value.charCodeAt(index);
|
||||
if (code <= 0x1f || code === 0x7f) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function isRestorableDesktopRoutePath(value: unknown): value is string {
|
||||
if (typeof value !== 'string') return false;
|
||||
if (value.length === 0 || value.length > MAX_LAST_ROUTE_LENGTH) return false;
|
||||
if (!value.startsWith('/')) return false;
|
||||
if (value.startsWith('//')) return false;
|
||||
if (value.includes('\\')) return false;
|
||||
if (value.includes('://')) return false;
|
||||
if (containsControlCharacter(value)) return false;
|
||||
for (const segment of value.split('/')) {
|
||||
if (segment === '..') return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Reference in new issue
Block a user