Merge branch 'dev' into 'pretzel-fixes'

Merge Dev to pretzel

See merge request crafty-controller/crafty-commander!165
This commit is contained in:
Andrew 2022-02-10 19:32:59 +00:00
commit a084b95426
7 changed files with 241 additions and 311 deletions

16
.editorconfig Normal file
View File

@ -0,0 +1,16 @@
# https://editorconfig.org
root = true
[*.{js,py,html}]
charset = utf-8
insert_final_newline = true
# end_of_line = lf
[*.py]
indent_style = space
indent_size = 4
[*.{js,html}]
indent_style = space
indent_size = 2

View File

@ -264,13 +264,25 @@ class PanelHandler(BaseHandler):
template = "public/error.html" template = "public/error.html"
elif page == 'credits': elif page == 'credits':
with open(helper.credits_cache, encoding='utf-8') as republic_credits_will_do: with open(helper.credits_cache, encoding='utf-8') as credits_default_local:
credits_dict: dict = json.load(republic_credits_will_do) try:
remote = requests.get('https://craftycontrol.com/credits', allow_redirects=True)
credits_dict: dict = remote.json()
if not credits_dict["staff"]:
logger.error("Issue with upstream Staff, using local.")
credits_dict: dict = json.load(credits_default_local)
except:
logger.error("Request to credits bucket failed, using local.")
credits_dict: dict = json.load(credits_default_local)
timestamp = credits_dict["lastUpdate"] / 1000.0 timestamp = credits_dict["lastUpdate"] / 1000.0
page_data["patrons"] = credits_dict["patrons"] page_data["patrons"] = credits_dict["patrons"]
page_data["staff"] = credits_dict["staff"] page_data["staff"] = credits_dict["staff"]
page_data["translations"] = credits_dict["translations"] page_data["translations"] = credits_dict["translations"]
page_data["lastUpdate"] = str(datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S')) if timestamp == 0:
page_data["lastUpdate"] = '😿'
else:
page_data["lastUpdate"] = str(datetime.datetime.fromtimestamp(timestamp).strftime('%Y-%m-%d %H:%M:%S'))
template = "panel/credits.html" template = "panel/credits.html"
elif page == 'contribute': elif page == 'contribute':

View File

@ -1,311 +1,132 @@
{ {
"staff": { "staff": {
"development": [ "development": [
{ {
"name": "Phil Tarrant", "name": "Pita Bread",
"title": "Creator", "title": "CEO",
"loc": "Southeast, USA", "loc": "Midwest, USA",
"tags": [ "tags": [ "Staff", [ "Developer", "https://gitlab.com/craftbreadth" ], "Crafty Leadership" ],
"Staff", "blurb": "Baked goods enthusiast who dabbles in Linux and sets up networks for fun. Can be found writing long-winded emails, debugging strange wifi issues, or taking care of his extensive houseplant collection.",
[ "pic": "/static/assets/images/credits/pita.png"
"Developer", },
"https://gitlab.com/Ptarrant1" {
], "name": "Xithical",
"Creator" "title": "CFO/COO",
], "loc": "Midwest, USA",
"blurb": "For best results, apply a thin layer of Phillip to code, cyber security, and parenthood for maximum effectiveness. Phillip often spends too much time with his chickens.", "tags": [ "Staff", [ "Developer", "https://gitlab.com/xithical" ], "Crafty Leadership" ],
"pic": "/static/assets/images/credits/ptarrant.png" "blurb": "Having sold his soul to the IT administration gods many eons ago, you can usually find him working, going home to do work, or continuing to work in the support Discord.",
}, "pic": "/static/assets/images/credits/xithical.png"
{ },
"name": "Pita Bread", {
"title": "Leadership Team", "name": "Phil Tarrant",
"loc": "Midwest, USA", "title": "Creator",
"tags": [ "loc": "Southeast, USA",
"Staff", "tags": [ "Staff", [ "Developer", "https://gitlab.com/Ptarrant1" ], "Crafty Advisor" ],
[ "blurb": "For best results, apply a thin layer of Phillip to code, cyber security, and parenthood for maximum effectiveness. Phillip often spends too much time with his chickens.",
"Developer", "pic": "/static/assets/images/credits/ptarrant.png"
"https://gitlab.com/craftbreadth" },
], {
"Community Leader" "name": "macgeek",
], "title": "Lead Software Engineer",
"blurb": "Baked goods enthusiast who dabbles in Linux and sets up networks for fun. Can be found writing long-winded emails, debugging strange wifi issues, or taking care of his extensive houseplant collection.", "loc": "Midwest, USA",
"pic": "/static/assets/images/credits/pita.png" "tags": [ "Staff", [ "Developer", "https://gitlab.com/computergeek125" ], "Crafty Advisor" ],
}, "blurb": "Sysadmin for work and sysadmin for fun (avid homelabber). He enjoys a good tech tangent and gaming.",
{ "pic": "/static/assets/images/credits/macgeek.png"
"name": "macgeek", },
"title": "Leadership Team", {
"loc": "Midwest, USA", "name": "parzivaldewey",
"tags": [ "title": "Support Manager",
"Staff", "loc": "East Coast, USA",
[ "tags": [ "Staff", [ "Developer", "https://gitlab.com/amcmanu3" ], "Support Manager" ],
"Developer", "blurb": "His interests include Linux, gaming, and helping others. When he's able to unplug he enjoys biking, hiking, and playing soccer.",
"https://gitlab.com/computergeek125" "pic": "/static/assets/images/credits/parzivaldewey.png"
], },
"Project Manager" {
], "name": "Silversthorn",
"blurb": "Sysadmin for work and sysadmin for fun (avid homelabber). He enjoys a good tech tangent and gaming.", "title": "Software Engineer",
"pic": "/static/assets/images/credits/macgeek.png" "loc": "Provence, FR",
}, "tags": [ "Staff", [ "Developer", "https://gitlab.com/Silversthorn" ], null ],
{ "blurb": "Developer at work and at home, testing his own code is a pain, so his coding precept is \"Testing is Doubting\"",
"name": "parzivaldewey", "pic": "/static/assets/images/credits/silversthorn.png"
"title": null, },
"loc": "East Coast, USA", {
"tags": [ "name": "ThatOneLukas",
"Staff", "title": "Software Engineer",
[ "loc": "Helsinki, FI",
"Developer", "tags": [ "Staff", [ "Developer", "https://gitlab.com/LukasDoesDev" ], null ],
"https://gitlab.com/amcmanu3" "blurb": "Arch Linux enthusiast who likes 80s/90s music, Rust (The programming language) and light distros like Arch Linux btw. Dislikes C, C++, Go, and Microsoft. Also doesn't like Finnish weather that freezes molten snow to (deadly) ice.",
], "pic": "/static/assets/images/credits/lukas.png"
"Support Manager" },
], {
"blurb": "His interests include Linux, gaming, and helping others. When he's able to unplug he enjoys biking, hiking, and playing soccer.", "name": "Zedifus",
"pic": "/static/assets/images/credits/parzivaldewey.png" "title": "DevOps Engineer",
}, "loc": "Scotland, UK",
{ "tags": [ "Staff", [ "Developer", "https://gitlab.com/Zedifus" ], "DevOps" ],
"name": "Xithical", "blurb": "A Streamer, who is currently working in the insurance industry, self-teaching software development & DevOps, with the hopes of a career change! Enjoys playing games and has a sassy cat called Eve.",
"title": null, "pic": "/static/assets/images/credits/zedifus.jpg"
"loc": "Midwest, USA", }
"tags": [ ],
"Staff", "support": [
[ {
"Developer", "name": "iSilverfyre",
"https://gitlab.com/xithical" "title": "Community Manager",
], "loc": "South Central, US",
null "tags": [ "Staff", null, "Wiki" ],
], "blurb": "Silver enjoys helping others with their computer needs, writing documentation, and loving her cat.",
"blurb": "Having sold his soul to the IT administration gods many eons ago, you can usually find him working, going home to do work, or continuing to work in the support Discord.", "pic": "/static/assets/images/credits/isilverfyre.png"
"pic": "/static/assets/images/credits/xithical.png" },
}, {
{ "name": "Quentin",
"name": "MC Gaming", "title": "Document Curator",
"title": null, "loc": null,
"loc": "Central, UK", "tags": [ "Staff", [ "Developer", "https://gitlab.com/qub3d" ], "Wiki" ],
"tags": [ "blurb": "Hosts Minecraft servers for his weird friends, works for an IoT company as his dayjob. The 's' in IoT stands for 'secure'.",
"Staff", "pic": "/static/assets/images/credits/qub3d.png"
[ }
"Developer", ],
"https://gitlab.com/MCgamin1738" "retired": [
], {
null "name": "Kev Dagoat",
], "title": "Head of Development",
"blurb": "His interests include learning, Linux, and programming. He loves pentesting apps and gaming.", "loc": "East Coast, AU",
"pic": "/static/assets/images/credits/mcgaming.png" "tags": [ "Staff", [ "Developer", "https://gitlab.com/kevdagoat" ], "HOD" ],
}, "blurb": "His interests include Linux, programming, and goats of course. He enjoys building APIs, K8s, and geeking over video cards.",
{ "pic": "/static/assets/images/credits/kevdagoat.jpeg"
"name": "Silversthorn", },
"title": null, {
"loc": "Provence, FR", "name": "Manu",
"tags": [ "title": null,
"Staff", "loc": "Eastern, CA",
[ "tags": [ "Staff", "Developer", "Project Manager" ],
"Developer", "blurb": "His interests include learning, Linux, and programming. He enjoys speaking French, doing 6 things at once, and testing software.",
"https://gitlab.com/Silversthorn" "pic": "/static/assets/images/credits/manu.png"
], },
null {
], "name": "UltraBlack",
"blurb": "Developer at work and at home, testing his own code is a pain, so his coding precept is \"Testing is Doubting\"", "title": null,
"pic": "/static/assets/images/credits/silversthorn.png" "loc": "Bavaria, DE",
}, "tags": [ "Staff", null, "Idea Manager" ],
{ "blurb": "Hi, my name is Tim, and I'm a huge fan of linux. I'm often gaming and occasionally coding.",
"name": "ThatOneLukas", "pic": "/static/assets/images/credits/ultrablack.png"
"title": null, },
"loc": "Helsinki, FI", {
"tags": [ "name": "MC Gaming",
"Staff", "title": null,
[ "loc": "Central, UK",
"Developer", "tags": [ "Staff", [ "Developer", "https://gitlab.com/MCgamin1738" ], null ],
"https://gitlab.com/LukasDoesDev" "blurb": "His interests include learning, Linux, and programming. He loves pentesting apps and gaming.",
], "pic": "/static/assets/images/credits/mcgaming.png"
null }
], ]
"blurb": "Lukas enjoys bashing his head at the table while his code does not work",
"pic": "/static/assets/images/credits/lukas.png"
},
{
"name": "Zedifus",
"title": null,
"loc": "Scotland, UK",
"tags": [
"Staff",
[
"Developer",
"https://gitlab.com/Zedifus"
],
"DevOps"
],
"blurb": "A Streamer, who is currently working in the insurance industry, self-teaching software development & DevOps, with the hopes of a career change! Enjoys playing games and has a sassy cat called Eve.",
"pic": "/static/assets/images/credits/zedifus.jpg"
}
],
"support": [
{
"name": "iSilverfyre",
"title": null,
"loc": null,
"tags": [
"Staff",
"Wiki",
null
],
"blurb": "Silver enjoys helping others with their computer needs, writing documentation, and loving her cat.",
"pic": "/static/assets/images/credits/isilverfyre.png"
},
{
"name": "Quentin",
"title": null,
"loc": null,
"tags": [
"Staff",
[
"Developer",
"https://gitlab.com/qub3d"
],
"Wiki"
],
"blurb": "Hosts Minecraft servers for his weird friends, works for an IoT company as his dayjob. The 's' in IoT stands for 'secure'.",
"pic": "/static/assets/images/credits/qub3d.png"
}
],
"retired": [
{
"name": "Kev Dagoat",
"title": "Head of Development",
"loc": "East Coast, AU",
"tags": [
"Staff",
[
"Developer",
"https://gitlab.com/kevdagoat"
],
"HOD"
],
"blurb": "His interests include Linux, programming, and goats of course. He enjoys building APIs, K8s, and geeking over video cards.",
"pic": "/static/assets/images/credits/kevdagoat.jpeg"
},
{
"name": "Manu",
"title": null,
"loc": "Eastern, CA",
"tags": [
"Staff",
"Developer",
"Project Manager"
],
"blurb": "His interests include learning, Linux, and programming. He enjoys speaking French, doing 6 things at once, and testing software.",
"pic": "/static/assets/images/credits/manu.png"
},
{
"name": "UltraBlack",
"title": null,
"loc": "Bavaria, DE",
"tags": [
"Staff",
null,
"Idea Manager"
],
"blurb": "Hi, my name is Tim, and I'm a huge fan of linux. I'm often gaming and occasionally coding.",
"pic": "/static/assets/images/credits/ultrablack.png"
}
]
}, },
"translations": { "translations": {
"ptarrant": [ "Data Unavailable": ["🌎🪣🔗👎😭"]
"Sarcasm",
"Wit"
],
"Lukas": [
"Finnish"
],
"Manu": [
"French"
],
"Silversthorn": [
"French"
],
"UltraBlack": [
"German"
],
"Zedifus": [
"LOLCAT (Kingdum ov Katz)"
]
}, },
"patrons": [ "patrons": [
{ {
"name": "Richard B", "name": "Data Unavailable 🌎🪣🔗👎😭",
"level": "Crafty Sustainer" "level": ""
},
{
"name": "JOHN C",
"level": "Crafty Advocate"
},
{
"name": "iSilverfyre",
"level": "Crafty Sustainer"
},
{
"name": "Dean R",
"level": "Crafty Sustainer"
},
{
"name": "scott m",
"level": "Crafty Sustainer"
},
{
"name": "Lino",
"level": "Crafty Sustainer"
},
{
"name": "PeterPorker3",
"level": "Crafty Supporter"
},
{
"name": "Ewari",
"level": "Crafty Supporter"
},
{
"name": "Thyodas",
"level": "Crafty Sustainer"
},
{
"name": "AngryPanda",
"level": "Crafty Sustainer"
},
{
"name": "Chris T",
"level": "Crafty Sustainer"
},
{
"name": "Adam B",
"level": "Crafty Sustainer"
},
{
"name": "Eric G",
"level": "Crafty Sustainer"
},
{
"name": "Chris B",
"level": "Crafty Sustainer"
},
{
"name": "Emmet d",
"level": "Crafty Sustainer"
},
{
"name": "Steven T",
"level": "Crafty Sustainer"
},
{
"name": "Row H",
"level": "Crafty Supporter"
},
{
"name": "vorboid",
"level": "Crafty Supporter"
},
{
"name": "Justman",
"level": "Crafty Sustainer"
} }
], ],
"lastUpdate": 1637635758855 "lastUpdate": 0
} }

View File

@ -207,6 +207,10 @@ if ($('canvas').length) {
body.toggleClass('sidebar-hidden'); body.toggleClass('sidebar-hidden');
} else { } else {
body.toggleClass('sidebar-icon-only'); body.toggleClass('sidebar-icon-only');
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
if (vw >= 1200) {
localStorage.setItem('crafty-sidebar-expanded', !body.hasClass('sidebar-icon-only'));
}
} }
}); });
@ -231,4 +235,4 @@ if ($('canvas').length) {
$(this).not(".brand-logo").attr('toggle-status', 'closed'); $(this).not(".brand-logo").attr('toggle-status', 'closed');
} }
}); });
})(jQuery); })(jQuery);

View File

@ -47,8 +47,17 @@
<img src="/static/assets/images/logo_small.svg" alt="logo" /> </a> <img src="/static/assets/images/logo_small.svg" alt="logo" /> </a>
</div> </div>
<div class="navbar-menu-wrapper d-flex align-items-center"> <div class="navbar-menu-wrapper d-flex align-items-center">
<style>
body:not(.sidebar-icon-only) .navbar-toggler .mdi-chevron-double-right {
display: none;
}
body.sidebar-icon-only .navbar-toggler .mdi-chevron-double-left {
display: none;
}
</style>
<button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize"> <button class="navbar-toggler navbar-toggler align-self-center" type="button" data-toggle="minimize">
<span class="mdi mdi-menu"></span> <span class="mdi mdi-chevron-double-left"></span>
<span class="mdi mdi-chevron-double-right"></span>
</button> </button>
{% include notify.html %} {% include notify.html %}
@ -423,4 +432,4 @@
</body> </body>
</html> </html>

View File

@ -1,6 +1,68 @@
<!-- partial --> <!-- partial -->
<div class="container-fluid page-body-wrapper"> <div class="container-fluid page-body-wrapper">
<!-- partial:partials/_sidebar.html --> <!-- partial:partials/_sidebar.html -->
<style>
@media screen and (max-width: 991px) {
.sidebar-offcanvas {
-webkit-transition: all 0.25s cubic-bezier(.22,.61,.36,1);
transition: all 0.25s cubic-bezier(.22,.61,.36,1);
box-shadow: 0px 8px 17px 2px rgba(0,0,0,0.14) , 0px 3px 14px 2px rgba(0,0,0,0.12) , 0px 5px 5px -3px rgba(0,0,0,0.2);
}
}
</style>
<script>
function debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this, args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
};
function isExtraLargeBreakpoint() {
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
return vw >= 1200;
}
function isLargeBreakpoint() {
const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
return vw >= 992;
}
$(document).ready(function() {
sidebarResizeHandler(null);
$(window).on(
'resize',
debounce(sidebarResizeHandler, 25, true)
);
});
function sidebarResizeHandler(e) {
/*
Viewport sizes: Extra large (vw >= 1200px), large (vw >= 992px), medium (vw >= 768px)
- A localstorage item is set to remember a user's preference between collapsed or expanded.
- For extra large viewports, the sidebar is the user's preference (by default expanded). When
expanded or collapsed manually, it doesn't overlap the page content and the preference
gets saved to a localstorage item.
- For large viewports, the sidebar is collapsed. When expanded manually, it doesn't overlap
the page content. The user's localstorage preference is not overridden during this state.
- For medium and below viewports, the sidebar is hidden behing a hamburger icon. When expanded, the sidebar
overlaps the page content. The user's localstorage preference is not overridden during this state.
More code in `app/frontend/static/assets/js/shared/misc.js` and `app/frontend/templates/base.html`
*/
if (isExtraLargeBreakpoint()) {
let value = localStorage.getItem('crafty-sidebar-expanded') !== 'false';
$('body').toggleClass('sidebar-icon-only', !value);
localStorage.setItem('crafty-sidebar-expanded', value);
} else if (isLargeBreakpoint()) {
$('body').toggleClass('sidebar-icon-only', true);
}
}
</script>
<nav class="sidebar sidebar-offcanvas" id="sidebar"> <nav class="sidebar sidebar-offcanvas" id="sidebar">
<ul class="nav"> <ul class="nav">
@ -37,7 +99,7 @@
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="https://gitlab.com/crafty-controller/crafty-web/-/wikis/home" target="_blank"> <a class="nav-link" href="https://wiki.craftycontrol.com" target="_blank">
<i class="fas fa-book"></i> &nbsp; <i class="fas fa-book"></i> &nbsp;
<span class="menu-title">{{ translate('sidebar', 'documentation', data['lang']) }}</span> <span class="menu-title">{{ translate('sidebar', 'documentation', data['lang']) }}</span>
</a> </a>
@ -68,4 +130,4 @@
</ul> </ul>
</nav> </nav>
<!-- partial --> <!-- partial -->

View File

@ -39,8 +39,10 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="user-avatar mb-auto"> <div class="user-avatar mb-auto">
{% if person['pic'] %}
<img src="{{ person['pic'] }}" <img src="{{ person['pic'] }}"
alt="profile image" class="profile-img img-lg rounded-circle"> alt="profile image" class="profile-img img-lg rounded-circle">
{% end %}
</div> </div>
<div class="wrapper"> <div class="wrapper">
@ -108,8 +110,10 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="user-avatar mb-auto"> <div class="user-avatar mb-auto">
{% if person['pic'] %}
<img src="{{ person['pic'] }}" <img src="{{ person['pic'] }}"
alt="profile image" class="profile-img img-lg rounded-circle"> alt="profile image" class="profile-img img-lg rounded-circle">
{% end %}
</div> </div>
<div class="wrapper"> <div class="wrapper">
@ -149,7 +153,7 @@
<div class="wrapper align-items-start pt-3"> <div class="wrapper align-items-start pt-3">
{% if person['title'] %} {% if person['title'] %}
<h5><strong>Crafty's {{ person['title'] }}</strong></h5> <h5><strong>{{ person['title'] }}</strong></h5>
{% end %} {% end %}
<p>{{ person['blurb'] }}</p> <p>{{ person['blurb'] }}</p>
</div> </div>
@ -178,8 +182,10 @@
<div class="col-md-4"> <div class="col-md-4">
<div class="user-avatar mb-auto"> <div class="user-avatar mb-auto">
{% if person['pic'] %}
<img src="{{ person['pic'] }}" <img src="{{ person['pic'] }}"
alt="profile image" class="profile-img img-lg rounded-circle"> alt="profile image" class="profile-img img-lg rounded-circle">
{% end %}
</div> </div>
<div class="wrapper"> <div class="wrapper">
@ -219,7 +225,7 @@
<div class="wrapper align-items-start pt-3"> <div class="wrapper align-items-start pt-3">
{% if person['title'] %} {% if person['title'] %}
<h5><strong>Crafty's {{ person['title'] }}</strong></h5> <h5><strong>{{ person['title'] }}</strong></h5>
{% end %} {% end %}
<p>{{ person['blurb'] }}</p> <p>{{ person['blurb'] }}</p>
</div> </div>