default plugins now have navbar removal logic
This commit is contained in:
parent
1eb7880de9
commit
fd6096a93c
1
TODO.txt
1
TODO.txt
@ -1,4 +1,3 @@
|
||||
* Remove nav bar links for disabled plugins
|
||||
* add GUI config editor
|
||||
* add multi-device forward secrecy
|
||||
* document anonymity & security theory
|
||||
|
@ -35,8 +35,6 @@ def _get_val_or_none(json: dict, key: str) -> Union[None, JSONSerializable]:
|
||||
|
||||
def set_config_from_onboarding(config_settings: OnboardingConfig):
|
||||
|
||||
network_security_level = 0
|
||||
theme = "dark"
|
||||
get = _get_val_or_none
|
||||
|
||||
if get(config_settings, 'stateTarget') or not get(config_settings,
|
||||
@ -47,18 +45,25 @@ def set_config_from_onboarding(config_settings: OnboardingConfig):
|
||||
if get(config_settings, 'useDark'):
|
||||
config.set('ui.theme', 'dark')
|
||||
|
||||
if not get(config_settings,
|
||||
'useCircles') or config.get('general.security_level') > 0:
|
||||
config.set('plugins.disabled',
|
||||
config.get('plugins.disabled').append('flow'))
|
||||
|
||||
if not get(config_settings, 'useMail'):
|
||||
config.set('plugins.disabled', ['pms'])
|
||||
config.set('plugins.disabled',
|
||||
config.get('plugins.disabled').append('pms'))
|
||||
|
||||
config.set('general.store_plaintext_blocks',
|
||||
get(config_settings, 'plainContrib'))
|
||||
|
||||
|
||||
config.set('onboarding.done', True, savefile=True)
|
||||
|
||||
|
||||
def set_onboarding_finished():
|
||||
"""Create the onboarding completed setting file"""
|
||||
Path(onboarding_mark_file).touch()
|
||||
|
||||
|
||||
def is_onboarding_finished() -> bool:
|
||||
return True
|
||||
|
@ -17,9 +17,9 @@
|
||||
<script defer src="/shared/identicon.js"></script>
|
||||
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotify.js'></script>
|
||||
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotifyButtons.js'></script>
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src="/shared/useridenticons.js"></script>
|
||||
<script defer src='/shared/misc.js'></script>
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src="/shared/main/apicheck.js"></script>
|
||||
<script defer src="detect-plaintext-storage.js"></script>
|
||||
<script defer src='sethumanreadable.js'></script>
|
||||
@ -37,14 +37,14 @@
|
||||
</a>
|
||||
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||
data-target="navbarBasicExample">
|
||||
data-target="navbarBasic">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div id="navbarBasic" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item idLink" href="/">Home</a>
|
||||
<a class="navbar-item idLink" href="/mail/">Mail</a>
|
||||
|
@ -26,7 +26,7 @@ function sortEntries(){
|
||||
}
|
||||
|
||||
for (i = 0; i < entries.length; i++){
|
||||
console.log(i)
|
||||
|
||||
if (entries[i].getAttribute('timestamp') > timestamp){
|
||||
if(entries[i].previousElementSibling){
|
||||
entries[i].parentNode.insertBefore(entries[i], entries[i].previousElementSibling)
|
||||
|
@ -10,13 +10,13 @@
|
||||
<link rel='shortcut icon' type='image/ico' href='/shared/images/favicon.ico'>
|
||||
<link rel="stylesheet" href="/gettheme">
|
||||
<link rel="stylesheet" href="/chat/css/convos.css">
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src='/shared/misc.js'></script>
|
||||
<script defer src='/shared/direct-connections.js'></script>
|
||||
<script defer src='/chat/js/messages.js'></script>
|
||||
<script defer src='/chat/js/message-feed.js'></script>
|
||||
<script defer src='/chat/js/resizes.js'></script>
|
||||
<script defer src='/chat/js/change-convo.js'></script>
|
||||
<script defer src="/shared/navbar.js"></script>
|
||||
<script defer src='/chat/js/main.js'></script>
|
||||
</head>
|
||||
|
||||
@ -29,14 +29,14 @@
|
||||
</a>
|
||||
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||
data-target="navbarBasicExample">
|
||||
data-target="navbarBasic">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div id="navbarBasic" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item idLink" href="/">Home</a>
|
||||
<a class="navbar-item idLink" href="/mail/">Mail</a>
|
||||
|
@ -13,9 +13,9 @@
|
||||
<link rel='stylesheet' href='/friends/style.css'>
|
||||
<script defer src="/shared/node_modules/pnotify/dist/iife/PNotify.js"></script>
|
||||
<script defer src="/shared/node_modules/pnotify/dist/iife/PNotifyButtons.js"></script>
|
||||
<script defer src="/shared/navbar.js"></script>
|
||||
<script defer src="/shared/misc.js"></script>
|
||||
<script defer src="/friends/friends.js"></script>
|
||||
<script defer src="/shared/navbar.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -27,14 +27,14 @@
|
||||
</a>
|
||||
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||
data-target="navbarBasicExample">
|
||||
data-target="navbarBasic">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div id="navbarBasic" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item idLink" href="/">Home</a>
|
||||
<a class="navbar-item idLink" href="/mail/">Mail</a>
|
||||
|
@ -14,12 +14,12 @@
|
||||
<link rel="stylesheet" href="/mail/mail.css">
|
||||
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotify.js'></script>
|
||||
<script defer src='/shared/node_modules/pnotify/dist/iife/PNotifyButtons.js'></script>
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src="/shared/main/apicheck.js"></script>
|
||||
<script defer src='/shared/misc.js'></script>
|
||||
<script defer src='/mail/sethumanreadable.js'></script>
|
||||
<script defer src='/mail/mail.js'></script>
|
||||
<script defer src='/mail/sendmail.js'></script>
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -31,14 +31,14 @@
|
||||
</a>
|
||||
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||
data-target="navbarBasicExample">
|
||||
data-target="navbarBasic">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div id="navbarBasic" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item idLink" href="/">Home</a>
|
||||
<a class="navbar-item idLink" href="/mail/">Mail</a>
|
||||
|
@ -14,7 +14,6 @@
|
||||
<link rel="stylesheet" href="/gettheme">
|
||||
<link rel="stylesheet" href="donate-modal.css">
|
||||
<link rel="stylesheet" href="onboarding.css">
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script defer src='/shared/loadabout.js'></script>
|
||||
<script defer src='/shared/misc.js'></script>
|
||||
<script defer src='/private/js/console.js'></script>
|
||||
|
@ -14,7 +14,6 @@
|
||||
<link rel="stylesheet" href="/gettheme">
|
||||
<script defer src="/shared/node_modules/pnotify/dist/iife/PNotify.js"></script>
|
||||
<script defer src="/shared/node_modules/pnotify/dist/iife/PNotifyButtons.js"></script>
|
||||
<script defer src="/shared/navbar.js"></script>
|
||||
<script defer src="/shared/loadabout.js"></script>
|
||||
<script defer src="/shared/misc.js"></script>
|
||||
<script defer src="/shared/main/stats.js"></script>
|
||||
@ -24,6 +23,7 @@
|
||||
<script defer src="/shared/main/apicheck.js"></script>
|
||||
<script defer src="/private/js/console.js"></script>
|
||||
<script defer src="/private/js/motd.js"></script>
|
||||
<script defer src='/shared/navbar.js'></script>
|
||||
<script>alert("Content security policy appears to not be working. Your browser security is weak!")</script>
|
||||
</head>
|
||||
|
||||
@ -42,14 +42,14 @@
|
||||
</a>
|
||||
|
||||
<a role="button" class="navbar-burger burger" aria-label="menu" aria-expanded="false"
|
||||
data-target="navbarBasicExample">
|
||||
data-target="navbarBasic">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="navbarBasicExample" class="navbar-menu">
|
||||
<div id="navbarBasic" class="navbar-menu">
|
||||
<div class="navbar-start">
|
||||
<a class="navbar-item idLink" href="/">Home</a>
|
||||
<a class="navbar-item idLink" href="/mail/">Mail</a>
|
||||
|
@ -1,3 +1,53 @@
|
||||
/*
|
||||
Onionr - Private P2P Communication
|
||||
|
||||
This file handles the navbar layout and folding
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
let navbarLinks = document.querySelectorAll('.navbar-start .navbar-item')
|
||||
|
||||
let deleteNavbar = function(){
|
||||
fetch('/config/get/plugins.disabled', {
|
||||
headers: {
|
||||
"token": webpass
|
||||
}})
|
||||
.then((resp) => resp.json())
|
||||
.then(function(disabled) {
|
||||
|
||||
if (disabled.length > 0){
|
||||
|
||||
for (x=0; x < navbarLinks.length; x++){
|
||||
if (disabled.includes('pms')){
|
||||
if (navbarLinks[x].innerText == 'Mail'){
|
||||
navbarLinks[x].style.display = 'none'
|
||||
}
|
||||
}
|
||||
if (disabled.includes('flow')){
|
||||
if (navbarLinks[x].innerText == 'Circles'){
|
||||
navbarLinks[x].style.display = 'none'
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}})
|
||||
|
||||
}
|
||||
deleteNavbar()
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
// This function taken from the official bulma docs
|
||||
/*
|
||||
@ -25,7 +75,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
*/
|
||||
|
||||
// Get all "navbar-burger" elements
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0);
|
||||
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0)
|
||||
|
||||
// Check if there are any navbar burgers
|
||||
if ($navbarBurgers.length > 0) {
|
||||
@ -47,3 +97,4 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user