Feat: Http proxy support. (Bare server still must be updated)

This commit is contained in:
rift 2024-01-15 10:23:50 -06:00
parent 666ca92547
commit 2c22a6afc6
10 changed files with 410 additions and 18 deletions

View file

@ -14,7 +14,7 @@
"@fastify/compress": "^6.5.0",
"@fastify/static": "^6.12.0",
"@nebula-services/dynamic": "0.7.2-patch.2",
"@nebula-services/ultraviolet": "1.0.1-1.patch.5",
"@nebula-services/ultraviolet": "1.0.1-1.patch.7",
"@tomphttp/bare-server-node": "^2.0.1",
"classnames": "^2.3.2",
"crypto-js": "^4.2.0",

257
pnpm-lock.yaml generated
View file

@ -15,8 +15,8 @@ dependencies:
specifier: 0.7.2-patch.2
version: 0.7.2-patch.2
'@nebula-services/ultraviolet':
specifier: 1.0.1-1.patch.5
version: 1.0.1-1.patch.5
specifier: 1.0.1-1.patch.7
version: 1.0.1-1.patch.7
'@tomphttp/bare-server-node':
specifier: ^2.0.1
version: 2.0.1
@ -426,6 +426,15 @@ packages:
dev: false
optional: true
/@esbuild/aix-ppc64@0.19.11:
resolution: {integrity: sha512-FnzU0LyE3ySQk7UntJO4+qIiQgI7KoODnZg5xzXIrFJlKd2P2gwHsHY4927xj9y5PJmJSzULiUCWmv7iWnNa7g==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [aix]
requiresBuild: true
dev: false
optional: true
/@esbuild/android-arm64@0.19.10:
resolution: {integrity: sha512-1X4CClKhDgC3by7k8aOWZeBXQX8dHT5QAMCAQDArCLaYfkppoARvh0fit3X2Qs+MXDngKcHv6XXyQCpY0hkK1Q==}
engines: {node: '>=12'}
@ -435,6 +444,15 @@ packages:
dev: false
optional: true
/@esbuild/android-arm64@0.19.11:
resolution: {integrity: sha512-aiu7K/5JnLj//KOnOfEZ0D90obUkRzDMyqd/wNAUQ34m4YUPVhRZpnqKV9uqDGxT7cToSDnIHsGooyIczu9T+Q==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
requiresBuild: true
dev: false
optional: true
/@esbuild/android-arm64@0.19.9:
resolution: {integrity: sha512-q4cR+6ZD0938R19MyEW3jEsMzbb/1rulLXiNAJQADD/XYp7pT+rOS5JGxvpRW8dFDEfjW4wLgC/3FXIw4zYglQ==}
engines: {node: '>=12'}
@ -453,6 +471,15 @@ packages:
dev: false
optional: true
/@esbuild/android-arm@0.19.11:
resolution: {integrity: sha512-5OVapq0ClabvKvQ58Bws8+wkLCV+Rxg7tUVbo9xu034Nm536QTII4YzhaFriQ7rMrorfnFKUsArD2lqKbFY4vw==}
engines: {node: '>=12'}
cpu: [arm]
os: [android]
requiresBuild: true
dev: false
optional: true
/@esbuild/android-arm@0.19.9:
resolution: {integrity: sha512-jkYjjq7SdsWuNI6b5quymW0oC83NN5FdRPuCbs9HZ02mfVdAP8B8eeqLSYU3gb6OJEaY5CQabtTFbqBf26H3GA==}
engines: {node: '>=12'}
@ -471,6 +498,15 @@ packages:
dev: false
optional: true
/@esbuild/android-x64@0.19.11:
resolution: {integrity: sha512-eccxjlfGw43WYoY9QgB82SgGgDbibcqyDTlk3l3C0jOVHKxrjdc9CTwDUQd0vkvYg5um0OH+GpxYvp39r+IPOg==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
requiresBuild: true
dev: false
optional: true
/@esbuild/android-x64@0.19.9:
resolution: {integrity: sha512-KOqoPntWAH6ZxDwx1D6mRntIgZh9KodzgNOy5Ebt9ghzffOk9X2c1sPwtM9P+0eXbefnDhqYfkh5PLP5ULtWFA==}
engines: {node: '>=12'}
@ -489,6 +525,15 @@ packages:
dev: false
optional: true
/@esbuild/darwin-arm64@0.19.11:
resolution: {integrity: sha512-ETp87DRWuSt9KdDVkqSoKoLFHYTrkyz2+65fj9nfXsaV3bMhTCjtQfw3y+um88vGRKRiF7erPrh/ZuIdLUIVxQ==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@esbuild/darwin-arm64@0.19.9:
resolution: {integrity: sha512-KBJ9S0AFyLVx2E5D8W0vExqRW01WqRtczUZ8NRu+Pi+87opZn5tL4Y0xT0mA4FtHctd0ZgwNoN639fUUGlNIWw==}
engines: {node: '>=12'}
@ -507,6 +552,15 @@ packages:
dev: false
optional: true
/@esbuild/darwin-x64@0.19.11:
resolution: {integrity: sha512-fkFUiS6IUK9WYUO/+22omwetaSNl5/A8giXvQlcinLIjVkxwTLSktbF5f/kJMftM2MJp9+fXqZ5ezS7+SALp4g==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@esbuild/darwin-x64@0.19.9:
resolution: {integrity: sha512-vE0VotmNTQaTdX0Q9dOHmMTao6ObjyPm58CHZr1UK7qpNleQyxlFlNCaHsHx6Uqv86VgPmR4o2wdNq3dP1qyDQ==}
engines: {node: '>=12'}
@ -525,6 +579,15 @@ packages:
dev: false
optional: true
/@esbuild/freebsd-arm64@0.19.11:
resolution: {integrity: sha512-lhoSp5K6bxKRNdXUtHoNc5HhbXVCS8V0iZmDvyWvYq9S5WSfTIHU2UGjcGt7UeS6iEYp9eeymIl5mJBn0yiuxA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
/@esbuild/freebsd-arm64@0.19.9:
resolution: {integrity: sha512-uFQyd/o1IjiEk3rUHSwUKkqZwqdvuD8GevWF065eqgYfexcVkxh+IJgwTaGZVu59XczZGcN/YMh9uF1fWD8j1g==}
engines: {node: '>=12'}
@ -543,6 +606,15 @@ packages:
dev: false
optional: true
/@esbuild/freebsd-x64@0.19.11:
resolution: {integrity: sha512-JkUqn44AffGXitVI6/AbQdoYAq0TEullFdqcMY/PCUZ36xJ9ZJRtQabzMA+Vi7r78+25ZIBosLTOKnUXBSi1Kw==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
requiresBuild: true
dev: false
optional: true
/@esbuild/freebsd-x64@0.19.9:
resolution: {integrity: sha512-WMLgWAtkdTbTu1AWacY7uoj/YtHthgqrqhf1OaEWnZb7PQgpt8eaA/F3LkV0E6K/Lc0cUr/uaVP/49iE4M4asA==}
engines: {node: '>=12'}
@ -561,6 +633,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-arm64@0.19.11:
resolution: {integrity: sha512-LneLg3ypEeveBSMuoa0kwMpCGmpu8XQUh+mL8XXwoYZ6Be2qBnVtcDI5azSvh7vioMDhoJFZzp9GWp9IWpYoUg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-arm64@0.19.9:
resolution: {integrity: sha512-PiPblfe1BjK7WDAKR1Cr9O7VVPqVNpwFcPWgfn4xu0eMemzRp442hXyzF/fSwgrufI66FpHOEJk0yYdPInsmyQ==}
engines: {node: '>=12'}
@ -579,6 +660,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-arm@0.19.11:
resolution: {integrity: sha512-3CRkr9+vCV2XJbjwgzjPtO8T0SZUmRZla+UL1jw+XqHZPkPgZiyWvbDvl9rqAN8Zl7qJF0O/9ycMtjU67HN9/Q==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-arm@0.19.9:
resolution: {integrity: sha512-C/ChPohUYoyUaqn1h17m/6yt6OB14hbXvT8EgM1ZWaiiTYz7nWZR0SYmMnB5BzQA4GXl3BgBO1l8MYqL/He3qw==}
engines: {node: '>=12'}
@ -597,6 +687,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-ia32@0.19.11:
resolution: {integrity: sha512-caHy++CsD8Bgq2V5CodbJjFPEiDPq8JJmBdeyZ8GWVQMjRD0sU548nNdwPNvKjVpamYYVL40AORekgfIubwHoA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-ia32@0.19.9:
resolution: {integrity: sha512-f37i/0zE0MjDxijkPSQw1CO/7C27Eojqb+r3BbHVxMLkj8GCa78TrBZzvPyA/FNLUMzP3eyHCVkAopkKVja+6Q==}
engines: {node: '>=12'}
@ -615,6 +714,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-loong64@0.19.11:
resolution: {integrity: sha512-ppZSSLVpPrwHccvC6nQVZaSHlFsvCQyjnvirnVjbKSHuE5N24Yl8F3UwYUUR1UEPaFObGD2tSvVKbvR+uT1Nrg==}
engines: {node: '>=12'}
cpu: [loong64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-loong64@0.19.9:
resolution: {integrity: sha512-t6mN147pUIf3t6wUt3FeumoOTPfmv9Cc6DQlsVBpB7eCpLOqQDyWBP1ymXn1lDw4fNUSb/gBcKAmvTP49oIkaA==}
engines: {node: '>=12'}
@ -633,6 +741,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-mips64el@0.19.11:
resolution: {integrity: sha512-B5x9j0OgjG+v1dF2DkH34lr+7Gmv0kzX6/V0afF41FkPMMqaQ77pH7CrhWeR22aEeHKaeZVtZ6yFwlxOKPVFyg==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-mips64el@0.19.9:
resolution: {integrity: sha512-jg9fujJTNTQBuDXdmAg1eeJUL4Jds7BklOTkkH80ZgQIoCTdQrDaHYgbFZyeTq8zbY+axgptncko3v9p5hLZtw==}
engines: {node: '>=12'}
@ -651,6 +768,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-ppc64@0.19.11:
resolution: {integrity: sha512-MHrZYLeCG8vXblMetWyttkdVRjQlQUb/oMgBNurVEnhj4YWOr4G5lmBfZjHYQHHN0g6yDmCAQRR8MUHldvvRDA==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-ppc64@0.19.9:
resolution: {integrity: sha512-tkV0xUX0pUUgY4ha7z5BbDS85uI7ABw3V1d0RNTii7E9lbmV8Z37Pup2tsLV46SQWzjOeyDi1Q7Wx2+QM8WaCQ==}
engines: {node: '>=12'}
@ -669,6 +795,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-riscv64@0.19.11:
resolution: {integrity: sha512-f3DY++t94uVg141dozDu4CCUkYW+09rWtaWfnb3bqe4w5NqmZd6nPVBm+qbz7WaHZCoqXqHz5p6CM6qv3qnSSQ==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-riscv64@0.19.9:
resolution: {integrity: sha512-DfLp8dj91cufgPZDXr9p3FoR++m3ZJ6uIXsXrIvJdOjXVREtXuQCjfMfvmc3LScAVmLjcfloyVtpn43D56JFHg==}
engines: {node: '>=12'}
@ -687,6 +822,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-s390x@0.19.11:
resolution: {integrity: sha512-A5xdUoyWJHMMlcSMcPGVLzYzpcY8QP1RtYzX5/bS4dvjBGVxdhuiYyFwp7z74ocV7WDc0n1harxmpq2ePOjI0Q==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-s390x@0.19.9:
resolution: {integrity: sha512-zHbglfEdC88KMgCWpOl/zc6dDYJvWGLiUtmPRsr1OgCViu3z5GncvNVdf+6/56O2Ca8jUU+t1BW261V6kp8qdw==}
engines: {node: '>=12'}
@ -705,6 +849,15 @@ packages:
dev: false
optional: true
/@esbuild/linux-x64@0.19.11:
resolution: {integrity: sha512-grbyMlVCvJSfxFQUndw5mCtWs5LO1gUlwP4CDi4iJBbVpZcqLVT29FxgGuBJGSzyOxotFG4LoO5X+M1350zmPA==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@esbuild/linux-x64@0.19.9:
resolution: {integrity: sha512-JUjpystGFFmNrEHQnIVG8hKwvA2DN5o7RqiO1CVX8EN/F/gkCjkUMgVn6hzScpwnJtl2mPR6I9XV1oW8k9O+0A==}
engines: {node: '>=12'}
@ -723,6 +876,15 @@ packages:
dev: false
optional: true
/@esbuild/netbsd-x64@0.19.11:
resolution: {integrity: sha512-13jvrQZJc3P230OhU8xgwUnDeuC/9egsjTkXN49b3GcS5BKvJqZn86aGM8W9pd14Kd+u7HuFBMVtrNGhh6fHEQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
requiresBuild: true
dev: false
optional: true
/@esbuild/netbsd-x64@0.19.9:
resolution: {integrity: sha512-GThgZPAwOBOsheA2RUlW5UeroRfESwMq/guy8uEe3wJlAOjpOXuSevLRd70NZ37ZrpO6RHGHgEHvPg1h3S1Jug==}
engines: {node: '>=12'}
@ -741,6 +903,15 @@ packages:
dev: false
optional: true
/@esbuild/openbsd-x64@0.19.11:
resolution: {integrity: sha512-ysyOGZuTp6SNKPE11INDUeFVVQFrhcNDVUgSQVDzqsqX38DjhPEPATpid04LCoUr2WXhQTEZ8ct/EgJCUDpyNw==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
requiresBuild: true
dev: false
optional: true
/@esbuild/openbsd-x64@0.19.9:
resolution: {integrity: sha512-Ki6PlzppaFVbLnD8PtlVQfsYw4S9n3eQl87cqgeIw+O3sRr9IghpfSKY62mggdt1yCSZ8QWvTZ9jo9fjDSg9uw==}
engines: {node: '>=12'}
@ -759,6 +930,15 @@ packages:
dev: false
optional: true
/@esbuild/sunos-x64@0.19.11:
resolution: {integrity: sha512-Hf+Sad9nVwvtxy4DXCZQqLpgmRTQqyFyhT3bZ4F2XlJCjxGmRFF0Shwn9rzhOYRB61w9VMXUkxlBy56dk9JJiQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
requiresBuild: true
dev: false
optional: true
/@esbuild/sunos-x64@0.19.9:
resolution: {integrity: sha512-MLHj7k9hWh4y1ddkBpvRj2b9NCBhfgBt3VpWbHQnXRedVun/hC7sIyTGDGTfsGuXo4ebik2+3ShjcPbhtFwWDw==}
engines: {node: '>=12'}
@ -777,6 +957,15 @@ packages:
dev: false
optional: true
/@esbuild/win32-arm64@0.19.11:
resolution: {integrity: sha512-0P58Sbi0LctOMOQbpEOvOL44Ne0sqbS0XWHMvvrg6NE5jQ1xguCSSw9jQeUk2lfrXYsKDdOe6K+oZiwKPilYPQ==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@esbuild/win32-arm64@0.19.9:
resolution: {integrity: sha512-GQoa6OrQ8G08guMFgeXPH7yE/8Dt0IfOGWJSfSH4uafwdC7rWwrfE6P9N8AtPGIjUzdo2+7bN8Xo3qC578olhg==}
engines: {node: '>=12'}
@ -795,6 +984,15 @@ packages:
dev: false
optional: true
/@esbuild/win32-ia32@0.19.11:
resolution: {integrity: sha512-6YOrWS+sDJDmshdBIQU+Uoyh7pQKrdykdefC1avn76ss5c+RN6gut3LZA4E2cH5xUEp5/cA0+YxRaVtRAb0xBg==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@esbuild/win32-ia32@0.19.9:
resolution: {integrity: sha512-UOozV7Ntykvr5tSOlGCrqU3NBr3d8JqPes0QWN2WOXfvkWVGRajC+Ym0/Wj88fUgecUCLDdJPDF0Nna2UK3Qtg==}
engines: {node: '>=12'}
@ -813,6 +1011,15 @@ packages:
dev: false
optional: true
/@esbuild/win32-x64@0.19.11:
resolution: {integrity: sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@esbuild/win32-x64@0.19.9:
resolution: {integrity: sha512-oxoQgglOP7RH6iasDrhY+R/3cHrfwIDvRlT4CGChflq6twk8iENeVvMJjmvBb94Ik1Z+93iGO27err7w6l54GQ==}
engines: {node: '>=12'}
@ -998,6 +1205,10 @@ packages:
resolution: {integrity: sha512-n3/+wko8WFd/fbiPCOuBB6HfKL6hTcygFEZ/MpmvpMRbgDSdlNMopDFGjsoTYqCbzTVTX9TL/StXco4yx2v58Q==}
dev: true
/@nebula-services/bare-client@1.1.2-beta.3-patch.1:
resolution: {integrity: sha512-SgXCJruqgFg9ulgKd/S+6IAL3G5lP08Ey+pLLv768pwvgV5WgXdoWxytV1jJ8kd0vpQcnrq3ropTn2buT+8r5Q==}
dev: false
/@nebula-services/dynamic@0.7.2-patch.2:
resolution: {integrity: sha512-0g1ygwVNS0dmT38NIeZYc2Z5HiZKHT3tP7ZagIeWC/VlcZjINIPR4ThNndWVaGiZey2Y2JS2807ABb41OSYTrw==}
dependencies:
@ -1027,12 +1238,13 @@ packages:
- utf-8-validate
dev: false
/@nebula-services/ultraviolet@1.0.1-1.patch.5:
resolution: {integrity: sha512-EDwbh+AXPg+JxPcPhRHJh6crLh1AHSodcAgfO47ug4paoLkWXE0ELU5Tm0Um38kguTBHzTOPFSzNULpaFbhFLw==}
/@nebula-services/ultraviolet@1.0.1-1.patch.7:
resolution: {integrity: sha512-9xe7BR1DbxtK+TeAlsllbuDE6j+eA9rMFQp4M05vkHjO5CuQYUFfC48m/y4vWhbna6Uf2xdlZLJr6gYGDJStBA==}
dependencies:
'@tomphttp/bare-client': 1.1.2-beta.3
'@nebula-services/bare-client': 1.1.2-beta.3-patch.1
crypto-js: 4.2.0
css-tree: 2.3.1
esbuild: 0.19.11
esotope-hammerhead: 0.6.7
events: 3.3.0
idb: 7.1.1
@ -1255,10 +1467,6 @@ packages:
dev: true
optional: true
/@tomphttp/bare-client@1.1.2-beta.3:
resolution: {integrity: sha512-WyIVnSAqzfrLejmOhh/l/LtDOeK+SHnBGi/z+QyliVP1T1JxoNE5eecwxlV+osM9J6FTAYVGNHr8/5bubaIj6Q==}
dev: false
/@tomphttp/bare-client@2.2.0-alpha:
resolution: {integrity: sha512-xhcflOpwr92tkpp8SoDhB3nK3LHMBIjx+vgow37XobQew2k0/mXSxmaU7BsDFpOIa1CcLCEsR8gWn0v7Cy9+7Q==}
dev: false
@ -2361,6 +2569,37 @@ packages:
'@esbuild/win32-x64': 0.19.10
dev: false
/esbuild@0.19.11:
resolution: {integrity: sha512-HJ96Hev2hX/6i5cDVwcqiJBBtuo9+FeIJOtZ9W1kA5M6AMJRHUZlpYZ1/SbEwtO0ioNAW8rUooVpC/WehY2SfA==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
'@esbuild/aix-ppc64': 0.19.11
'@esbuild/android-arm': 0.19.11
'@esbuild/android-arm64': 0.19.11
'@esbuild/android-x64': 0.19.11
'@esbuild/darwin-arm64': 0.19.11
'@esbuild/darwin-x64': 0.19.11
'@esbuild/freebsd-arm64': 0.19.11
'@esbuild/freebsd-x64': 0.19.11
'@esbuild/linux-arm': 0.19.11
'@esbuild/linux-arm64': 0.19.11
'@esbuild/linux-ia32': 0.19.11
'@esbuild/linux-loong64': 0.19.11
'@esbuild/linux-mips64el': 0.19.11
'@esbuild/linux-ppc64': 0.19.11
'@esbuild/linux-riscv64': 0.19.11
'@esbuild/linux-s390x': 0.19.11
'@esbuild/linux-x64': 0.19.11
'@esbuild/netbsd-x64': 0.19.11
'@esbuild/openbsd-x64': 0.19.11
'@esbuild/sunos-x64': 0.19.11
'@esbuild/win32-arm64': 0.19.11
'@esbuild/win32-ia32': 0.19.11
'@esbuild/win32-x64': 0.19.11
dev: false
/esbuild@0.19.9:
resolution: {integrity: sha512-U9CHtKSy+EpPsEBa+/A2gMs/h3ylBC0H0KSqIg7tpztHerLi6nrrcoUJAkNCEPumx8yJ+Byic4BVwHgRbN0TBg==}
engines: {node: '>=12'}

View file

@ -29,7 +29,12 @@ const uvPromise = new Promise(async (resolve) => {
try {
const bare =
(await localforage.getItem("bare")) || location.origin + "/bare/";
const proxyUrl =
(await localforage.getItem("HTTPProxy")) || "";
const [proxyIP, proxyPort] = proxyUrl.split(":");
self.__uv$config.bare = bare;
self.__uv$config.proxyPort = proxyPort;
self.__uv$config.proxyIp = proxyIP;
self.uv = new UVServiceWorker(self.__uv$config);
} catch (error) {
console.log(error);

View file

@ -7,5 +7,7 @@ self.__uv$config = {
client: "/uv/uv.client.js",
bundle: "/uv/uv.bundle.js",
config: "/uv/uv.config.js",
sw: "/uv/uv.sw.js"
sw: "/uv/uv.sw.js",
proxyIp: "",
proxyPort: ""
};

View file

@ -60,6 +60,11 @@
"title": "Theme",
"subtitle": "Choose a theme so your eyes don't hate us",
"select": "Select"
},
"httpProxy": {
"title": "(Advanced) HTTP Proxy",
"subtitle": "Enter your own HTTP proxy to access geo-restricted content. This will only work with compatible Bare servers.",
"link": "What is this?"
}
},
"titles": {

View file

@ -59,6 +59,11 @@
"theme": {
"title": "Mirar",
"subtitle": "Elige una mirada para que tus ojos no nos odienn"
},
"httpProxy": {
"title": "(Advanced) HTTP Proxy",
"subtitle": "Enter your own HTTP proxy to access geo-restricted content. This will only work with compatible Bare servers.",
"link": "What is this?"
}
},
"titles": {

View file

@ -59,6 +59,11 @@
"theme": {
"title": "テーマ",
"subtitle": "目が嫌いにならないようにテーマを選んでください"
},
"httpProxy": {
"title": "(高度な) HTTPプロキシ",
"subtitle": "地理的に制限されたコンテンツにアクセスするために、あなた自身のHTTPプロキシを入力してください。これは互換性のあるBareサーバーでのみ機能します。",
"link": "これは何ですか?"
}
},
"titles": {

View file

@ -42,6 +42,10 @@ function BareInput(props: BareInputProps) {
(document.getElementById("input") as HTMLInputElement).value
);
set(props.storageKey, url);
set("HTTPProxy", ""); // Disable http proxy servicesssss (most bare servers won't support these and we don't want to be untruthful to the user.)
localStorage.setItem("HTTPProxy", "");
localStorage.setItem(props.storageKey, url);
uninstallServiceWorkers();
window.location.reload();

View file

@ -2,6 +2,7 @@ import { motion } from "framer-motion";
import { tabContentVariant, settingsPageVariant } from "./Variants";
import Dropdown from "./Dropdown";
import BareInput from "./BareInput";
import ProxyInput from "./ProxyInput";
import { useTranslation } from "react-i18next";
const Proxy = ({ id, active }) => {
@ -83,19 +84,21 @@ const Proxy = ({ id, active }) => {
</div>
<BareInput placeholder="/bare/" storageKey="bare" />
</div>
{/* <div className="flex h-80 w-96 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-2 text-center">
<div className="flex h-96 w-96 flex-col flex-wrap content-center items-center rounded-lg border border-input-border-color bg-lighter p-2 text-center">
<div className="p-2 text-3xl font-bold text-input-text">
(Advanced) HTTP Proxy
{t("settings.httpProxy.title")}
</div>
<div className="text-md p-4 font-bold text-input-text">
Enter your own HTTP proxy to access geo-restricted content. This
will only work with compatible Bare servers.
{t("settings.httpProxy.subtitle")}
</div>
<div className="text-md pb-4 font-bold text-input-text underline">
<a href="q">What is this?</a>
<a href="/faq#4">{t("settings.httpProxy.link")}</a>
</div>
<BareInput placeholder="/bare/" storageKey="bare" />
</div> */}
<ProxyInput
placeholder="username:password@1.2.3.4"
storageKey="bare"
/>
</div>
</motion.div>
</motion.div>
);

View file

@ -0,0 +1,124 @@
import { useState, useEffect } from "preact/hooks";
import { set } from "../../util/IDB";
import { uninstallServiceWorkers } from "../../util/SWHelper";
import { useTranslation } from "react-i18next";
import { ToastContainer, toast } from "react-toastify";
interface BareInputProps {
placeholder: string;
storageKey: string;
}
function ProxyInput(props: BareInputProps) {
const { t } = useTranslation();
const bareServer = localStorage.getItem("bare") || "/bare/";
const HTTPProxy = localStorage.getItem("HTTPProxy") || "";
const [inputValue, setInputValue] = useState(HTTPProxy);
function validateUrl(url: string) {
let finalUrl = url;
if (url === null || url === undefined || url === "") {
finalUrl = "";
return finalUrl;
}
return finalUrl;
}
function handleChange() {
const proxyUrl = validateUrl(
(document.getElementById("pinput") as HTMLInputElement).value
);
if (!(proxyUrl === "")) {
const [proxyIP, proxyPort] = proxyUrl.split(":");
fetch(bareServer)
.then((response) => response.json())
.then((jsonResponse) => {
if (jsonResponse.hasOwnProperty("HTTPProxy")) {
const headers = new Headers({
"x-bare-url": "https://www.google.com",
"X-Bare-Headers": JSON.stringify({
Accept:
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9"
}),
"x-bare-proxy-ip": proxyIP,
"x-bare-proxy-port": proxyPort
});
return fetch(bareServer + "v3/", {
method: "GET",
headers: headers
})
.then((response) => {
if (
response.headers.get("x-bare-status") === "200" ||
response.headers.get("x-bare-status") === "302"
) {
// Success!
set("HTTPProxy", proxyUrl);
localStorage.setItem("HTTPProxy", proxyUrl);
uninstallServiceWorkers();
window.location.reload();
return true;
} else {
(
document.getElementById("pinput") as HTMLInputElement
).value = localStorage.getItem("HTTPProxy") || "";
toast("Bad proxy", {
type: "error"
});
}
})
.catch((error) => {
(document.getElementById("pinput") as HTMLInputElement).value =
localStorage.getItem("HTTPProxy") || "";
toast("Bad proxy", {
type: "error"
});
});
} else {
(document.getElementById("pinput") as HTMLInputElement).value =
localStorage.getItem("HTTPProxy") || "";
toast("That bare server doesn't support HTTP proxies!", {
type: "error"
});
}
})
.catch((error) => console.error("Error:", error));
} else {
// reset UV config to have no proxy
set("HTTPProxy", "");
localStorage.setItem("HTTPProxy", "");
uninstallServiceWorkers();
window.location.reload();
}
}
return (
<div>
<ToastContainer position="bottom-right" theme="dark" />
<div className="flex flex-col items-center">
<input
type="text"
placeholder={props.placeholder}
value={inputValue}
onKeyPress={(event) => {
if (event.key === "Enter") {
handleChange();
}
}}
id="pinput"
className="font-roboto flex h-14 w-56 flex-row rounded-2xl border border-input-border-color bg-input p-4 text-center text-sm"
/>
<div
className="font-roboto mt-2 flex h-4 w-36 cursor-pointer flex-row items-center justify-center rounded-xl border border-input-border-color bg-input p-5 text-center text-lg"
onClick={handleChange}
>
{t("settings.bare.select")}
</div>
</div>
</div>
);
}
export default ProxyInput;