Skip to content

Commit d9e4db9

Browse files
Fix some bugs and other things
1 parent f655a2d commit d9e4db9

3 files changed

Lines changed: 36 additions & 10 deletions

File tree

src/public/js/settings.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,21 @@ function changeWisp(value) {
234234
}
235235

236236
function transportChange(value) {
237-
if (value === 'soon') {
238-
return;
237+
function epoxy() {
238+
localStorage.setItem('transports', 'epoxy');
239+
setTransports('epoxy');
240+
}
241+
function defaultFUNC() {
242+
localStorage.setItem('transports', 'libcurl');
243+
setTransports('libcurl');
244+
setItems();
239245
}
240246
if (value === 'epoxy') {
241-
notifyBeta('Epoxy', setEpoxyTransport, setTransports);
247+
notifyBeta('Epoxy', epoxy, defaultFUNC);
242248
}
243249
else {
244250
localStorage.setItem('transports', value);
245-
setTransports();
251+
setTransports(value);
246252
}
247253
}
248254

src/public/js/transports.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
1-
const transports = localStorage.getItem('transports');
21
const wispUrl = localStorage.getItem('wispUrl') || (location.protocol === "https:" ? "wss" : "ws") + "://" + location.host + "/wisp/";
32

4-
function setTransports() {
5-
switch (transports) {
3+
function setTransports(transport) {
4+
function localStorageTransport() {
5+
switch (localStorage.getItem('transports')) {
6+
case 'libcurl':
7+
setLibcurlTransport();
8+
break;
9+
case 'epoxy':
10+
setEpoxyTransport();
11+
break;
12+
default:
13+
setLibcurlTransport();
14+
break;
15+
}
16+
}
17+
switch (transport) {
618
case 'libcurl':
719
setLibcurlTransport();
820
break;
921
case 'epoxy':
1022
setEpoxyTransport();
1123
break;
1224
default:
13-
setEpoxyTransport();
25+
localStorageTransport();
1426
break;
1527
}
1628
}
@@ -20,8 +32,16 @@ function setLibcurlTransport() {
2032
BareMux.SetTransport('CurlMod.LibcurlClient', { wisp: localStorage.getItem('wispUrl') || wispUrl, wasm: '/libcurl.wasm' })
2133
}
2234

35+
function destroyLibcurlTransport() {
36+
//remove all wasm modules
37+
38+
for (let i = 0; i < WebAssembly.Module.length; i++) {
39+
WebAssembly.Module[i].dispose();
40+
}
41+
}
42+
2343
function setDefaultTransport() {
24-
if (!transports) {
44+
if (!localStorage.getItem('transports')) {
2545
localStorage.setItem('transports', 'libcurl');
2646
setLibcurlTransport();
2747
}

src/views/components/settings.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<div id="tile">
3939
<h2> Proxy </h2>
4040
<select id="proxySelect" class="select" onchange="proxyChange(this.value)">
41-
<option value="uv"> UltraViolet </option>
41+
<option value="uv"> Ultraviolet </option>
4242
<!-- option value="dynamic"> Dynamic (Beta) </option -->
4343
<option value="rammerhead"> Rammerhead </option>
4444
</select>

0 commit comments

Comments
 (0)