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
|
||||
__version__ = "0.3.3"
|
||||
__version__ = "0.3.4"
|
||||
|
||||
import secrets
|
||||
import configparser
|
||||
|
@ -35,17 +35,20 @@
|
||||
{% else %}
|
||||
var bsVersion = 4;
|
||||
{% endif %}
|
||||
console.log('create');
|
||||
var css = document.createElement('link');
|
||||
css.setAttribute('rel', 'stylesheet');
|
||||
css.setAttribute('type', 'text/css');
|
||||
var cssCookie = getCookie("css");
|
||||
if (cssCookie.includes('bs' + bsVersion)) {
|
||||
console.log('href');
|
||||
css.setAttribute('href', cssCookie);
|
||||
} else {
|
||||
console.log('href');
|
||||
css.setAttribute('href', '{{ css_file }}');
|
||||
};
|
||||
console.log('append');
|
||||
document.head.appendChild(css);
|
||||
// document.querySelectorAll('link[rel="stylesheet"][type="text/css"]')[0].href = cssCookie;
|
||||
</script>
|
||||
{% 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>
|
||||
@ -235,6 +238,11 @@
|
||||
<div class="card-header">Generate Invite</div>
|
||||
<div class="card-body">
|
||||
<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">
|
||||
<label for="hours">Hours</label>
|
||||
<select class="form-control" id="hours" name="hours">
|
||||
|
@ -150,15 +150,19 @@ function parseInvite(invite, empty = false) {
|
||||
} else {
|
||||
var i = ["", "", "0", invite['email']];
|
||||
i[0] = invite['code'];
|
||||
if (invite['hours'] == 0) {
|
||||
i[1] = invite['minutes'] + 'm';
|
||||
} else if (invite['minutes'] == 0) {
|
||||
i[1] = invite['hours'] + 'h';
|
||||
} else {
|
||||
i[1] = invite['hours'] + 'h ' + invite['minutes'] + 'm';
|
||||
var time = ""
|
||||
if (invite['days'] != 0) {
|
||||
time += invite['days'] + 'd ';
|
||||
}
|
||||
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
|
||||
|
||||
}
|
||||
}
|
||||
function addItem(invite) {
|
||||
@ -176,6 +180,7 @@ function addItem(invite) {
|
||||
var listRight = document.createElement('div');
|
||||
listText = document.createElement('span');
|
||||
listText.id = invite[0] + '_expiry'
|
||||
listText.setAttribute('style', 'margin-right: 1rem;');
|
||||
listText.appendChild(document.createTextNode(invite[1]));
|
||||
listRight.appendChild(listText);
|
||||
if (invite[2] == 0) {
|
||||
@ -359,6 +364,9 @@ document.getElementById('loginForm').onsubmit = function() {
|
||||
window.token = data['token'];
|
||||
generateInvites();
|
||||
var interval = setInterval(function() { generateInvites(); }, 60 * 1000);
|
||||
var day = document.getElementById('days');
|
||||
addOptions(30, day);
|
||||
day.selected = "0";
|
||||
var hour = document.getElementById('hours');
|
||||
addOptions(24, hour);
|
||||
hour.selected = "0";
|
||||
|
@ -200,7 +200,9 @@ def newUser():
|
||||
def generateInvite():
|
||||
current_time = datetime.datetime.now()
|
||||
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 = {}
|
||||
log.debug(f"Creating new invite: {invite_code}")
|
||||
@ -245,6 +247,7 @@ def getInvites():
|
||||
valid_for = expiry - current_time
|
||||
invite = {
|
||||
"code": code,
|
||||
"days": valid_for.days,
|
||||
"hours": valid_for.seconds // 3600,
|
||||
"minutes": (valid_for.seconds // 60) % 60,
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "jellyfin-accounts"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
readme = "README.md"
|
||||
description = "A simple account management system for Jellyfin"
|
||||
authors = ["Harvey Tindall <harveyltindall@gmail.com>"]
|
||||
|
@ -120,6 +120,10 @@ $list-group-action-active-bg: $jf-blue-focus;
|
||||
color: $jf-text-bold;
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
color: $text-muted;
|
||||
}
|
||||
|
||||
.text-bright {
|
||||
color: $jf-text-bold;
|
||||
}
|
||||
|
@ -120,6 +120,10 @@ $list-group-action-active-bg: $jf-blue-focus;
|
||||
color: $jf-text-bold;
|
||||
}
|
||||
|
||||
.icon-button:active {
|
||||
color: $text-muted;
|
||||
}
|
||||
|
||||
.text-bright {
|
||||
color: $jf-text-bold;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user