mirror of
https://github.com/hrfee/jellyfin-accounts.git
synced 2024-12-22 09:00:14 +00:00
Small CSS tweaks, add days input
This commit is contained in:
parent
a3d3d97b3b
commit
94e69ad090
@ -1,5 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
__version__ = "0.3.3"
|
__version__ = "0.3.4"
|
||||||
|
|
||||||
import secrets
|
import secrets
|
||||||
import configparser
|
import configparser
|
||||||
|
@ -35,17 +35,20 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
var bsVersion = 4;
|
var bsVersion = 4;
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
console.log('create');
|
||||||
var css = document.createElement('link');
|
var css = document.createElement('link');
|
||||||
css.setAttribute('rel', 'stylesheet');
|
css.setAttribute('rel', 'stylesheet');
|
||||||
css.setAttribute('type', 'text/css');
|
css.setAttribute('type', 'text/css');
|
||||||
var cssCookie = getCookie("css");
|
var cssCookie = getCookie("css");
|
||||||
if (cssCookie.includes('bs' + bsVersion)) {
|
if (cssCookie.includes('bs' + bsVersion)) {
|
||||||
|
console.log('href');
|
||||||
css.setAttribute('href', cssCookie);
|
css.setAttribute('href', cssCookie);
|
||||||
} else {
|
} else {
|
||||||
|
console.log('href');
|
||||||
css.setAttribute('href', '{{ css_file }}');
|
css.setAttribute('href', '{{ css_file }}');
|
||||||
};
|
};
|
||||||
|
console.log('append');
|
||||||
document.head.appendChild(css);
|
document.head.appendChild(css);
|
||||||
// document.querySelectorAll('link[rel="stylesheet"][type="text/css"]')[0].href = cssCookie;
|
|
||||||
</script>
|
</script>
|
||||||
{% if not bs5 %}
|
{% if not bs5 %}
|
||||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||||
@ -235,6 +238,11 @@
|
|||||||
<div class="card-header">Generate Invite</div>
|
<div class="card-header">Generate Invite</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<form action="#" method="POST" id="inviteForm">
|
<form action="#" method="POST" id="inviteForm">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="days">Days</label>
|
||||||
|
<select class="form-control" id="days" name="days">
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="hours">Hours</label>
|
<label for="hours">Hours</label>
|
||||||
<select class="form-control" id="hours" name="hours">
|
<select class="form-control" id="hours" name="hours">
|
||||||
|
@ -150,15 +150,19 @@ function parseInvite(invite, empty = false) {
|
|||||||
} else {
|
} else {
|
||||||
var i = ["", "", "0", invite['email']];
|
var i = ["", "", "0", invite['email']];
|
||||||
i[0] = invite['code'];
|
i[0] = invite['code'];
|
||||||
if (invite['hours'] == 0) {
|
var time = ""
|
||||||
i[1] = invite['minutes'] + 'm';
|
if (invite['days'] != 0) {
|
||||||
} else if (invite['minutes'] == 0) {
|
time += invite['days'] + 'd ';
|
||||||
i[1] = invite['hours'] + 'h';
|
|
||||||
} else {
|
|
||||||
i[1] = invite['hours'] + 'h ' + invite['minutes'] + 'm';
|
|
||||||
}
|
}
|
||||||
i[1] = "Expires in " + i[1] + " ";
|
if (invite['hours'] != 0) {
|
||||||
|
time += invite['hours'] + 'h ';
|
||||||
|
}
|
||||||
|
if (invite['minutes'] != 0) {
|
||||||
|
time += invite['minutes'] + 'm ';
|
||||||
|
}
|
||||||
|
i[1] = "Expires in " + time.slice(0, -1);
|
||||||
return i
|
return i
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function addItem(invite) {
|
function addItem(invite) {
|
||||||
@ -176,6 +180,7 @@ function addItem(invite) {
|
|||||||
var listRight = document.createElement('div');
|
var listRight = document.createElement('div');
|
||||||
listText = document.createElement('span');
|
listText = document.createElement('span');
|
||||||
listText.id = invite[0] + '_expiry'
|
listText.id = invite[0] + '_expiry'
|
||||||
|
listText.setAttribute('style', 'margin-right: 1rem;');
|
||||||
listText.appendChild(document.createTextNode(invite[1]));
|
listText.appendChild(document.createTextNode(invite[1]));
|
||||||
listRight.appendChild(listText);
|
listRight.appendChild(listText);
|
||||||
if (invite[2] == 0) {
|
if (invite[2] == 0) {
|
||||||
@ -359,6 +364,9 @@ document.getElementById('loginForm').onsubmit = function() {
|
|||||||
window.token = data['token'];
|
window.token = data['token'];
|
||||||
generateInvites();
|
generateInvites();
|
||||||
var interval = setInterval(function() { generateInvites(); }, 60 * 1000);
|
var interval = setInterval(function() { generateInvites(); }, 60 * 1000);
|
||||||
|
var day = document.getElementById('days');
|
||||||
|
addOptions(30, day);
|
||||||
|
day.selected = "0";
|
||||||
var hour = document.getElementById('hours');
|
var hour = document.getElementById('hours');
|
||||||
addOptions(24, hour);
|
addOptions(24, hour);
|
||||||
hour.selected = "0";
|
hour.selected = "0";
|
||||||
|
@ -200,7 +200,9 @@ def newUser():
|
|||||||
def generateInvite():
|
def generateInvite():
|
||||||
current_time = datetime.datetime.now()
|
current_time = datetime.datetime.now()
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
delta = datetime.timedelta(hours=int(data["hours"]), minutes=int(data["minutes"]))
|
delta = datetime.timedelta(
|
||||||
|
days=int(data["days"]), hours=int(data["hours"]), minutes=int(data["minutes"])
|
||||||
|
)
|
||||||
invite_code = secrets.token_urlsafe(16)
|
invite_code = secrets.token_urlsafe(16)
|
||||||
invite = {}
|
invite = {}
|
||||||
log.debug(f"Creating new invite: {invite_code}")
|
log.debug(f"Creating new invite: {invite_code}")
|
||||||
@ -245,6 +247,7 @@ def getInvites():
|
|||||||
valid_for = expiry - current_time
|
valid_for = expiry - current_time
|
||||||
invite = {
|
invite = {
|
||||||
"code": code,
|
"code": code,
|
||||||
|
"days": valid_for.days,
|
||||||
"hours": valid_for.seconds // 3600,
|
"hours": valid_for.seconds // 3600,
|
||||||
"minutes": (valid_for.seconds // 60) % 60,
|
"minutes": (valid_for.seconds // 60) % 60,
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "jellyfin-accounts"
|
name = "jellyfin-accounts"
|
||||||
version = "0.3.3"
|
version = "0.3.4"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "A simple account management system for Jellyfin"
|
description = "A simple account management system for Jellyfin"
|
||||||
authors = ["Harvey Tindall <harveyltindall@gmail.com>"]
|
authors = ["Harvey Tindall <harveyltindall@gmail.com>"]
|
||||||
|
@ -120,6 +120,10 @@ $list-group-action-active-bg: $jf-blue-focus;
|
|||||||
color: $jf-text-bold;
|
color: $jf-text-bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-button {
|
||||||
|
color: $text-muted;
|
||||||
|
}
|
||||||
|
|
||||||
.text-bright {
|
.text-bright {
|
||||||
color: $jf-text-bold;
|
color: $jf-text-bold;
|
||||||
}
|
}
|
||||||
|
@ -120,6 +120,10 @@ $list-group-action-active-bg: $jf-blue-focus;
|
|||||||
color: $jf-text-bold;
|
color: $jf-text-bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-button:active {
|
||||||
|
color: $text-muted;
|
||||||
|
}
|
||||||
|
|
||||||
.text-bright {
|
.text-bright {
|
||||||
color: $jf-text-bold;
|
color: $jf-text-bold;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user