cmd/tailscale/cli: [web] update JS in web.html for Unraid support
Signed-off-by: Shayne Sweeney <shayne@tailscale.com>unraid-web
parent
b15d8525d0
commit
1dc9edde90
|
@ -116,12 +116,12 @@
|
||||||
<a class="text-xs text-gray-500 hover:text-gray-600" href="{{ .LicensesURL }}">Open Source Licenses</a>
|
<a class="text-xs text-gray-500 hover:text-gray-600" href="{{ .LicensesURL }}">Open Source Licenses</a>
|
||||||
</footer>
|
</footer>
|
||||||
<script>(function () {
|
<script>(function () {
|
||||||
const advertiseExitNode = {{.AdvertiseExitNode}};
|
const advertiseExitNode = {{ .AdvertiseExitNode }};
|
||||||
const isUnraid = {{.IsUnraid}};
|
const isUnraid = {{ .IsUnraid }};
|
||||||
const unraidCsrfToken = "{{.UnraidToken}}";
|
const unraidCsrfToken = "{{ .UnraidToken }}";
|
||||||
let fetchingUrl = false;
|
let fetchingUrl = false;
|
||||||
var data = {
|
var data = {
|
||||||
AdvertiseRoutes: "{{.AdvertiseRoutes}}",
|
AdvertiseRoutes: "{{ .AdvertiseRoutes }}",
|
||||||
AdvertiseExitNode: advertiseExitNode,
|
AdvertiseExitNode: advertiseExitNode,
|
||||||
Reauthenticate: false,
|
Reauthenticate: false,
|
||||||
ForceLogout: false
|
ForceLogout: false
|
||||||
|
@ -143,20 +143,18 @@ function postData(e) {
|
||||||
}
|
}
|
||||||
const nextUrl = new URL(window.location);
|
const nextUrl = new URL(window.location);
|
||||||
nextUrl.search = nextParams.toString()
|
nextUrl.search = nextParams.toString()
|
||||||
const url = nextUrl.toString();
|
|
||||||
|
|
||||||
|
let contentType = "application/json";
|
||||||
|
let body = JSON.stringify(data);
|
||||||
if (isUnraid) {
|
if (isUnraid) {
|
||||||
var formBody = [];
|
const params = new URLSearchParams();
|
||||||
formBody.push(encodeURIComponent("csrf_token") + "=" + encodeURIComponent(unraidCsrfToken));
|
params.append("csrf_token", unraidCsrfToken);
|
||||||
formBody.push(encodeURIComponent("ts_data") + "=" + encodeURIComponent(JSON.stringify(data)));
|
params.append("ts_data", JSON.stringify(data));
|
||||||
|
body = params.toString();
|
||||||
var body = formBody.join("&");
|
contentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
||||||
var contentType = "application/x-www-form-urlencoded;charset=UTF-8";
|
|
||||||
} else {
|
|
||||||
var body = JSON.stringify(data);
|
|
||||||
var contentType = "application/json";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const url = nextUrl.toString();
|
||||||
fetch(url, {
|
fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
Loading…
Reference in New Issue