-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
deba34a
commit f305cae
Showing
1 changed file
with
72 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
<title>Xray Config Validator</title> | ||
|
||
<script src="wasm_exec.js"></script> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css"> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.7.2/css/all.min.css"> | ||
|
||
<style> | ||
* { | ||
|
@@ -43,7 +43,8 @@ | |
#output { | ||
padding: 10px; | ||
line-height: 1.2; | ||
margin-top: 20px; | ||
margin-top: 10px; | ||
margin-bottom: 20px; | ||
border-radius: 5px; | ||
border: 1px solid #ced4da; | ||
text-align: center; | ||
|
@@ -76,7 +77,7 @@ | |
justify-content: flex-end; | ||
align-items: center; | ||
gap: 10px; | ||
margin-bottom: 20px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.button-group button { | ||
|
@@ -90,8 +91,21 @@ | |
font-size: 1rem; | ||
cursor: pointer; | ||
transition: background-color 0.2s ease, color 0.2s ease; | ||
background-color: #f0f0f5; | ||
color: #333; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.button-group button:hover { | ||
background-color: #e0e0eb; | ||
} | ||
|
||
.button-group button:active { | ||
background-color: #d0d0df; | ||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
|
||
h1 { | ||
font-size: 1.8rem; | ||
font-weight: 500; | ||
|
@@ -109,23 +123,6 @@ | |
color: transparent; | ||
} | ||
|
||
|
||
|
||
.button-group button { | ||
background-color: #f0f0f5; | ||
color: #333; | ||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.button-group button:hover { | ||
background-color: #e0e0eb; | ||
} | ||
|
||
.button-group button:active { | ||
background-color: #d0d0df; | ||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
body.dark-theme { | ||
background-color: #121212; | ||
color: #ffffff; | ||
|
@@ -152,6 +149,7 @@ | |
background-color: #555; | ||
} | ||
|
||
|
||
#loading-indicator { | ||
display: flex; | ||
justify-content: center; | ||
|
@@ -187,7 +185,7 @@ | |
margin-right: 0; | ||
} | ||
</style> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs/loader.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs/loader.min.js"></script> | ||
</head> | ||
<body> | ||
<div id="loading-indicator"> | ||
|
@@ -196,7 +194,7 @@ | |
|
||
<div class="container"> | ||
<div class="button-group"> | ||
<span id="version-info">Loading Xray… </span> | ||
<span id="version-info">Loading… </span> | ||
<button id="theme-toggle"><i class="fas fa-adjust"></i></button> | ||
<button id="share-config"><i class="fas fa-share-alt"></i></button> | ||
</div> | ||
|
@@ -226,7 +224,7 @@ <h1>Xray Config Validator</h1> | |
const result = await WebAssembly.instantiateStreaming(fetch('main.wasm'), go.importObject); | ||
go.run(result.instance); | ||
await isReady; | ||
document.getElementById("version-info").innerText = `${XrayGetVersion()}`; | ||
document.getElementById("version-info").innerText = `v${XrayGetVersion()}`; | ||
} catch (error) { | ||
console.error("Error loading WASM:", error); | ||
document.getElementById("version-info").innerText = "Error loading Xray. Check the browser console."; | ||
|
@@ -237,7 +235,7 @@ <h1>Xray Config Validator</h1> | |
} | ||
})(); | ||
|
||
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs' } }); | ||
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.2/min/vs' } }); | ||
require(['vs/editor/editor.main'], async function () { | ||
|
||
const editorElement = document.getElementById('editor'); | ||
|
@@ -320,7 +318,7 @@ <h1>Xray Config Validator</h1> | |
editor.layout(); | ||
}); | ||
|
||
const brotli = await import("https://unpkg.com/[email protected].0/index.web.js?module").then(m => m.default); | ||
const brotli = await import("https://unpkg.com/[email protected].1/index.web.js?module").then(m => m.default); | ||
const textEncoder = new TextEncoder(); | ||
const textDecoder = new TextDecoder('utf-8'); | ||
|
||
|
@@ -362,7 +360,55 @@ <h1>Xray Config Validator</h1> | |
let encodedConfig = urlParams.get('c'); | ||
|
||
function setDefaultConfigValue() { | ||
editor.setValue(`{}`); | ||
editor.setValue(`{ | ||
"inbounds": [ | ||
{ | ||
"listen": "127.0.0.1", | ||
"port": 10808, | ||
"protocol": "socks", | ||
"settings": { | ||
"udp": true | ||
}, | ||
"sniffing": { | ||
"enabled": true, | ||
"destOverride": [ | ||
"http", | ||
"tls" | ||
] | ||
} | ||
} | ||
], | ||
"outbounds": [ | ||
{ | ||
"protocol": "vless", | ||
"settings": { | ||
"vnext": [ | ||
{ | ||
"address": "", | ||
"port": 443, | ||
"users": [ | ||
{ | ||
"id": "user", | ||
"encryption": "none", | ||
"flow": "xtls-rprx-vision" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"streamSettings": { | ||
"network": "raw", | ||
"security": "tls", | ||
"tlsSettings": { | ||
"serverName": "", | ||
"allowInsecure": false, | ||
"fingerprint": "chrome" | ||
} | ||
}, | ||
"tag": "proxy" | ||
} | ||
] | ||
}`); | ||
} | ||
|
||
function decodeAndLoadConfig(encodedConfig) { | ||
|