Commit 4ae536ce authored by koyu's avatar koyu 🏳🌈

Add admin code, bump 1.8.4 and add custom sections

parent 8c2e4767
This diff is collapsed.
......@@ -563,4 +563,25 @@ def getlastplayed(username, uuid, instance, feed):
if uuid in suid:
return json.dumps({"login": "ok", "uuid": uuid, "lastplayed": lastplayed})
@post("/api/v1/admin/custom/<adminkey>/<lang>")
def setcustom(adminkey, lang):
response.headers['Access-Control-Allow-Origin'] = '*'
response.content_type = "application/json"
content = request.forms.get("content") # pylint: disable=no-member
if adminkey == ADMINKEY:
f = open("data/"+lang+"/custom", "w")
f.write(content)
f.close()
return json.dumps({"login": "ok", "action": "success"})
else:
return "{\"action\": \"error\"}"
@get("/api/v1/getcustom/<lang>")
def getcustom(lang):
f = open("data/"+lang+"/custom", "r")
x = f.read()
f.close()
response.headers['Access-Control-Allow-Origin'] = '*'
return x
run(server="tornado",port=9000,host="0.0.0.0")
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.Sommerlichter.nordcast" version="1.8.3" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<widget id="com.Sommerlichter.nordcast" version="1.8.4" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>Nordcast</name>
<description>
A new podcast app
......
......@@ -89,7 +89,7 @@
<p><span id="text__darkmode">Enable dark mode</span> <img src="darth.png" id="starwars" class="emoji"> <input id="cdark__mode" type="checkbox"></p>
<br />
<h2 id="text__about">About</h2>
<p>Nordcast <span id="version">1.8.3</span></p>
<p>Nordcast <span id="version">1.8.4</span></p>
<p><a href="#" onclick="window.open('https://nordcast.app', '_system'); return false;" id="text__website">Website</a> | <a href="#" onclick="window.open('https://git.koyu.space/koyu/nordcast', '_system'); return false;" id="text__sourcecode">Source code</a></p>
<p>&copy; koyu.space 2020</p>
</div>
......
......@@ -66,17 +66,19 @@ function removejscssfile(filename, filetype){
function drr2() {
$(document).ready(function() {
if (device.platform === "android") {
$.get("https://updates.koyu.space/nordcast/latest", function(data) {
if ($("#version").html() !== data.split("\n")[0]) {
if (localStorage.getItem("lang") !== "de") {
alert("New version " + data.split("\n")[0] + " available. Please update as soon as possible.");
} else {
alert("Neue Version " + data.split("\n")[0] + " verfügbar. Bitte so schnell wie möglich aktualisieren.");
window.setTimeout(function() {
if (device.platform === "android" || device.platform === "browser") {
$.get("https://updates.koyu.space/nordcast/latest", function(data) {
if ($("#version").html() !== data.split("\n")[0]) {
if (localStorage.getItem("lang") !== "de") {
alert("New version " + data.split("\n")[0] + " available. Please update as soon as possible.");
} else {
alert("Neue Version " + data.split("\n")[0] + " verfügbar. Bitte so schnell wie möglich aktualisieren.");
}
}
}
});
}
});
}
}, 3000);
window.setInterval(function() {
if (localStorage.getItem("uuid") === "dummy") {
$(".dlbutton").hide();
......@@ -103,8 +105,10 @@ function drr2() {
}
if (findGetParameter("view") === "main") {
$("#view__yourlist").hide();
$("#section__custom").show();
} else {
$(".bigscreen").hide();
$("#section__custom").hide();
}
if (findGetParameter("view") !== "settings" && localStorage.getItem("uuid") !== "dummy" && localStorage.getItem("offline") === "false") {
$(".fa__nav2").show();
......@@ -813,6 +817,12 @@ function drr2() {
if (localStorage.getItem("offline") === "true") {
location.href = "app.html#view=yourlist";
}
$.get(backend+"/api/v1/getcustomsection/"+localStorage.getItem("lang"), function(data) {
$("#text__custom").html(data.split("\n")[0]);
var custom = data.split("\n");
custom.shift();
$("#text__custom").html(custom);
});
} else {
$("#section__featured").hide();
$("#section__originals").hide();
......
......@@ -717,7 +717,7 @@ h1 .emoji {
}
.item p {
width: 90vw;
width: 80vw;
}
/* Hack for ionicicons v2 (no animation code) */
......
......@@ -15,6 +15,8 @@
<div id="section__originals"></div>
<h2 id="text__newforyou">New for you</h2>
<div id="section__newforyou"></div>
<h2 id="text__custom"></h2>
<div id="section__custom"></div>
<div id="view__yourlist" style="display: none;">
<h3 class="text__list">Your list</h3><i style="float:right;font-size:24pt;" class="icon ion-md-refresh" onclick="kicker=true;"></i><br><br><br>
<div id="section__list"></div><br>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment