Spiegel von
https://github.com/dani-garcia/vaultwarden.git
synchronisiert 2024-05-20 16:00:04 +02:00
f4a9645b54
Squashed commit of the following: commit 1bdf1c7954e0731c95703d10118f3874ab5155d3 Merge:8ba6e61
7257251
Author: Daniel García <dani-garcia@users.noreply.github.com> Date: Sun Jan 23 23:40:17 2022 +0100 Merge branch 'remove-bwrs' of https://github.com/RealOrangeOne/vaultwarden into RealOrangeOne-remove-bwrs commit7257251ecf
Author: Jake Howard <git@theorangeone.net> Date: Thu Jan 6 17:48:18 2022 +0000 Use `or_else` to save potentially unnecessary function call commit40ae81dd3c
Author: Jake Howard <git@theorangeone.net> Date: Wed Jan 5 21:18:24 2022 +0000 Move $BWRS_VERSION fallback into build.rs commit743ef74b30
Author: Jake Howard <git@theorangeone.net> Date: Sat Jan 1 23:08:27 2022 +0000 Revert "Add feature to enable use of `Option::or` in const context" This reverts commitfe8e043b8a
. We want to run on stable soon, where these features are not supported commita1f0da638c
Author: Jake Howard <git@theorangeone.net> Date: Sat Jan 1 13:04:47 2022 +0000 Rename web vault version file https://github.com/dani-garcia/bw_web_builds/pull/58 commitfe8e043b8a
Author: Jake Howard <git@theorangeone.net> Date: Sat Jan 1 12:56:44 2022 +0000 Add feature to enable use of `Option::or` in const context commit687435c8b2
Author: Jake Howard <git@theorangeone.net> Date: Sat Jan 1 12:27:28 2022 +0000 Continue to allow using `$BWRS_VERSION` commit8e2f708e50
Author: Jake Howard <git@theorangeone.net> Date: Fri Dec 31 11:41:34 2021 +0000 Remove references to "bwrs" The only remaining one is getting the version of the web vault, which requires coordinating with the web vault patching.
141 Zeilen
5,8 KiB
Handlebars
141 Zeilen
5,8 KiB
Handlebars
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
|
<meta name="robots" content="noindex,nofollow" />
|
|
<link rel="icon" type="image/png" href="{{urlpath}}/vw_static/vaultwarden-icon.png">
|
|
<title>Vaultwarden Admin Panel</title>
|
|
<link rel="stylesheet" href="{{urlpath}}/vw_static/bootstrap.css" />
|
|
<style>
|
|
body {
|
|
padding-top: 75px;
|
|
}
|
|
img {
|
|
width: 48px;
|
|
height: 48px;
|
|
}
|
|
.vaultwarden-icon {
|
|
height: 32px;
|
|
width: auto;
|
|
margin: -5px 0 0 0;
|
|
}
|
|
</style>
|
|
<script src="{{urlpath}}/vw_static/identicon.js"></script>
|
|
<script>
|
|
'use strict';
|
|
|
|
function reload() { window.location.reload(); }
|
|
function msg(text, reload_page = true) {
|
|
text && alert(text);
|
|
reload_page && reload();
|
|
}
|
|
async function sha256(message) {
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
|
|
const msgUint8 = new TextEncoder().encode(message);
|
|
const hashBuffer = await crypto.subtle.digest('SHA-256', msgUint8);
|
|
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
return hashHex;
|
|
}
|
|
async function identicon(email) {
|
|
const hash = await sha256(email);
|
|
const data = new Identicon(hash, { size: 48, format: 'svg' });
|
|
return "data:image/svg+xml;base64," + data.toString();
|
|
}
|
|
function toggleVis(input_id) {
|
|
const elem = document.getElementById(input_id);
|
|
const type = elem.getAttribute("type");
|
|
if (type === "text") {
|
|
elem.setAttribute("type", "password");
|
|
} else {
|
|
elem.setAttribute("type", "text");
|
|
}
|
|
return false;
|
|
}
|
|
function _post(url, successMsg, errMsg, body, reload_page = true) {
|
|
fetch(url, {
|
|
method: 'POST',
|
|
body: body,
|
|
mode: "same-origin",
|
|
credentials: "same-origin",
|
|
headers: { "Content-Type": "application/json" }
|
|
}).then( resp => {
|
|
if (resp.ok) { msg(successMsg, reload_page); return Promise.reject({error: false}); }
|
|
const respStatus = resp.status;
|
|
const respStatusText = resp.statusText;
|
|
return resp.text();
|
|
}).then( respText => {
|
|
try {
|
|
const respJson = JSON.parse(respText);
|
|
return respJson ? respJson.ErrorModel.Message : "Unknown error";
|
|
} catch (e) {
|
|
return Promise.reject({body:respStatus + ' - ' + respStatusText, error: true});
|
|
}
|
|
}).then( apiMsg => {
|
|
msg(errMsg + "\n" + apiMsg, reload_page);
|
|
}).catch( e => {
|
|
if (e.error === false) { return true; }
|
|
else { msg(errMsg + "\n" + e.body, reload_page); }
|
|
});
|
|
}
|
|
</script>
|
|
</head>
|
|
|
|
<body class="bg-light">
|
|
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4 shadow fixed-top">
|
|
<div class="container-xl">
|
|
<a class="navbar-brand" href="{{urlpath}}/admin"><img class="vaultwarden-icon" src="{{urlpath}}/vw_static/vaultwarden-icon.png" alt="V">aultwarden Admin</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarCollapse"
|
|
aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarCollapse">
|
|
<ul class="navbar-nav me-auto">
|
|
{{#if logged_in}}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{urlpath}}/admin">Settings</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{urlpath}}/admin/users/overview">Users</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{urlpath}}/admin/organizations/overview">Organizations</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{urlpath}}/admin/diagnostics">Diagnostics</a>
|
|
</li>
|
|
{{/if}}
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="{{urlpath}}/" target="_blank" rel="noreferrer">Vault</a>
|
|
</li>
|
|
</ul>
|
|
|
|
{{#if logged_in}}
|
|
<a class="btn btn-sm btn-secondary" href="{{urlpath}}/admin/logout">Log Out</a>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
{{> (lookup this "page_content") }}
|
|
|
|
<!-- This script needs to be at the bottom, else it will fail! -->
|
|
<script>
|
|
'use strict';
|
|
|
|
// get current URL path and assign 'active' class to the correct nav-item
|
|
(() => {
|
|
const pathname = window.location.pathname;
|
|
if (pathname === "") return;
|
|
let navItem = document.querySelectorAll('.navbar-nav .nav-item a[href="'+pathname+'"]');
|
|
if (navItem.length === 1) {
|
|
navItem[0].className = navItem[0].className + ' active';
|
|
navItem[0].setAttribute('aria-current', 'page');
|
|
}
|
|
})();
|
|
</script>
|
|
<script src="{{urlpath}}/vw_static/bootstrap-native.js"></script>
|
|
</body>
|
|
</html>
|