mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-07-03 19:34:34 +00:00
3ca644eb3d
Ports the framework-agnostic JS from web/assets/js/ into frontend/src/
so Vue 3 pages can import what they need without relying on script-tag
globals.
- web/assets/js/util/index.js (927 lines, 21 classes) →
frontend/src/utils/legacy.js + a barrel at utils/index.js. All
classes are now named exports.
- Vue.prototype.$message in HttpUtil → direct import of `message`
from ant-design-vue (Vue 3 has no Vue.prototype).
- RandomUtil.randomShadowsocksPassword previously defaulted to
SSMethods.BLAKE3_AES_256_GCM from inbound.js, creating a circular
import. Replaced with the literal string default.
- MediaQueryMixin (Vue 2 mixin) removed. Replaced by
composables/useMediaQuery.js — Vue 3 composable returning reactive
`isMobile`.
- axios-init.js wrapped as setupAxios(); Qs global → npm `qs`.
- websocket.js exported as WebSocketClient class; the implicit
window.wsClient global is gone — pages instantiate it themselves.
- model/{inbound,outbound,dbinbound,setting,reality_targets}.js
copied with `export` added on every top-level declaration. Imports
between models and utils are wired up explicitly.
- subscription.js deferred to Phase 5 (it's a Vue 2 mount, not a util).
- App.vue smoke test exercises SizeFormatter / RandomUtil / Wireguard /
useMediaQuery so the user can verify Phase 3 with `npm run dev`.
Run `cd frontend && npm install && npm run dev` — qs was added so a
fresh install is required.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
25 lines
961 B
JavaScript
25 lines
961 B
JavaScript
// List of popular services for VLESS Reality Target/SNI randomization
|
|
export const REALITY_TARGETS = [
|
|
{ target: 'www.amazon.com:443', sni: 'www.amazon.com' },
|
|
{ target: 'aws.amazon.com:443', sni: 'aws.amazon.com' },
|
|
{ target: 'www.oracle.com:443', sni: 'www.oracle.com' },
|
|
{ target: 'www.nvidia.com:443', sni: 'www.nvidia.com' },
|
|
{ target: 'www.amd.com:443', sni: 'www.amd.com' },
|
|
{ target: 'www.intel.com:443', sni: 'www.intel.com' },
|
|
{ target: 'www.sony.com:443', sni: 'www.sony.com' }
|
|
];
|
|
|
|
/**
|
|
* Returns a random Reality target configuration from the predefined list
|
|
* @returns {Object} Object with target and sni properties
|
|
*/
|
|
export function getRandomRealityTarget() {
|
|
const randomIndex = Math.floor(Math.random() * REALITY_TARGETS.length);
|
|
const selected = REALITY_TARGETS[randomIndex];
|
|
// Return a copy to avoid reference issues
|
|
return {
|
|
target: selected.target,
|
|
sni: selected.sni
|
|
};
|
|
}
|