Skip to content

Commit

Permalink
Bug fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
bia-pain-bache committed Oct 15, 2024
1 parent 47e5b97 commit 6348c5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 8 additions & 7 deletions _worker.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,7 @@ async function updateDataset (env, newSettings, resetSettings) {
}

const remoteDNSPattern = /^(?:[a-zA-Z]+:\/\/)?([^:\/\s?]+)/;
const remoteDNS = validateField('remoteDNS') ?? currentSettings?.remoteDNS;
const remoteDNS = validateField('remoteDNS') ?? currentSettings?.remoteDNS ?? 'https://8.8.8.8/dns-query';
const serverMatch = remoteDNS.match(remoteDNSPattern);
const remoteDNSServer = serverMatch ? serverMatch[1] : undefined;
const isServerDomain = isDomain(remoteDNSServer);
Expand All @@ -1258,7 +1258,7 @@ async function updateDataset (env, newSettings, resetSettings) {
}

const proxySettings = {
remoteDNS: remoteDNS ?? 'https://8.8.8.8/dns-query',
remoteDNS: remoteDNS,
resolvedRemoteDNS: resolvedRemoteDNS ?? {},
localDNS: validateField('localDNS') ?? currentSettings?.localDNS ?? '8.8.8.8',
vlessTrojanFakeDNS: validateField('vlessTrojanFakeDNS') ?? currentSettings?.vlessTrojanFakeDNS ?? false,
Expand Down Expand Up @@ -1448,15 +1448,17 @@ function renderHomePage (proxySettings, hostName, isPassSet) {
const isWarpPlus = warpPlusLicense ? true : false;
let activeProtocols = (vlessConfigs ? 1 : 0) + (trojanConfigs ? 1 : 0);
let httpPortsBlock = '', httpsPortsBlock = '';
const allPorts = [...(hostName.includes('workers.dev') ? defaultHttpPorts : []), ...defaultHttpsPorts];

[...defaultHttpPorts, ...defaultHttpsPorts].forEach(port => {
allPorts.forEach(port => {
let id = `port-${port}`;
const isChecked = ports.includes(port) ? 'checked' : '';
let portBlock = `
<div class="routing" style="grid-template-columns: 1fr 2fr; margin-right: 10px;">
<input type="checkbox" id=${id} name=${port} onchange="handlePortChange(event)" value="true" ${ports.includes(port) ? 'checked' : ''}>
<input type="checkbox" id=${id} name=${port} onchange="handlePortChange(event)" value="true" ${isChecked}>
<label style="margin-bottom: 3px;" for=${id}>${port}</label>
</div>`;
defaultHttpPorts.includes(port) ? httpPortsBlock += portBlock : httpsPortsBlock += portBlock;
defaultHttpsPorts.includes(port) ? httpsPortsBlock += portBlock : httpPortsBlock += portBlock;
});

const html = `
Expand Down Expand Up @@ -1636,7 +1638,6 @@ function renderHomePage (proxySettings, hostName, isPassSet) {
border-radius: 10px;
margin-bottom: 20px;
overflow: hidden;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
th, td { padding: 10px; border-bottom: 1px solid var(--border-color); }
td div { display: flex; align-items: center; }
Expand Down Expand Up @@ -1852,7 +1853,7 @@ function renderHomePage (proxySettings, hostName, isPassSet) {
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;">${httpsPortsBlock}</div>
</td>
</tr>
${hostName.includes('pages.dev') ? '' : `<tr>
${!httpPortsBlock ? '' : `<tr>
<td style="text-align: center; font-size: larger;"><b>Non TLS</b></td>
<td>
<div style="display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;">${httpPortsBlock}</div>
Expand Down

0 comments on commit 6348c5b

Please sign in to comment.