Add direct gateway forwarding when VPN is off
This commit is contained in:
@@ -36,6 +36,27 @@ export function localProxyUrls(port = 8082, host = '127.0.0.1') {
|
||||
};
|
||||
}
|
||||
|
||||
export async function copyText(text, options = {}) {
|
||||
const clipboard = options.clipboard ?? globalThis.navigator?.clipboard;
|
||||
const documentRef = options.documentRef ?? globalThis.document;
|
||||
|
||||
if (documentRef?.execCommand) {
|
||||
const textarea = documentRef.createElement('textarea');
|
||||
textarea.value = text;
|
||||
textarea.setAttribute('readonly', '');
|
||||
textarea.style.position = 'fixed';
|
||||
textarea.style.opacity = '0';
|
||||
documentRef.body.append(textarea);
|
||||
textarea.select();
|
||||
const copied = documentRef.execCommand('copy');
|
||||
textarea.remove();
|
||||
if (copied) return;
|
||||
}
|
||||
|
||||
if (!clipboard?.writeText) throw new Error('Copy failed');
|
||||
await clipboard.writeText(text);
|
||||
}
|
||||
|
||||
export function subscriptionUsage(userInfo = {}) {
|
||||
const upload = Math.max(0, Number(userInfo.upload) || 0);
|
||||
const download = Math.max(0, Number(userInfo.download) || 0);
|
||||
|
||||
Reference in New Issue
Block a user