1
0
mirror of https://github.com/krateng/maloja.git synced 2023-08-10 21:12:55 +03:00
maloja/website/setup.html

134 lines
4.7 KiB
HTML
Raw Normal View History

2019-03-04 19:39:21 +03:00
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Maloja - Setup</title>
2019-03-24 18:04:44 +03:00
<script src="javascript/cookies.js"></script>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<script>
2019-03-24 18:04:44 +03:00
2019-03-04 19:39:21 +03:00
function replaceurls() {
url = window.location.origin
s = document.getElementsByName("serverurl")
for (var i=0;i<s.length;i++) {
s[i].innerHTML = url
}
}
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
function replace() {
replaceurls();
}
2019-03-24 16:56:34 +03:00
function activateRuleModule(e,filename) {
2019-03-24 18:04:44 +03:00
if (apikeycorrect) {
keys = "filename=" + encodeURIComponent(filename)
apikey = document.getElementById("apikey").value
keys += "&key=" + encodeURIComponent(apikey)
console.log(keys)
var xhttp = new XMLHttpRequest();
2019-05-12 12:58:51 +03:00
xhttp.open("POST","/api/importrules", true);
2019-03-24 18:04:44 +03:00
xhttp.send(keys);
e.innerHTML = e.innerHTML.replace("Add","Remove")
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("activate","deactivate")
/* Nobody ever look at this code please */
}
2019-03-24 16:56:34 +03:00
}
function deactivateRuleModule(e,filename) {
2019-03-24 18:04:44 +03:00
if (apikeycorrect) {
keys = "remove&filename=" + encodeURIComponent(filename)
apikey = document.getElementById("apikey").value
keys += "&key=" + encodeURIComponent(apikey)
2019-03-24 16:56:34 +03:00
2019-03-24 18:04:44 +03:00
var xhttp = new XMLHttpRequest();
2019-05-12 12:58:51 +03:00
xhttp.open("POST","/api/importrules", true);
2019-03-24 18:04:44 +03:00
xhttp.send(keys);
2019-03-24 16:56:34 +03:00
2019-03-24 18:04:44 +03:00
e.innerHTML = e.innerHTML.replace("Remove","Add")
e.getAttributeNode("onclick").value = e.getAttribute("onclick").replace("deactivate","activate")
}
2019-03-24 16:56:34 +03:00
}
2019-03-04 19:39:21 +03:00
</script>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
</head>
2019-03-24 16:56:34 +03:00
2019-03-24 18:04:44 +03:00
<body onload="replace();insertAPIKeyFromCookie()">
2019-03-04 19:39:21 +03:00
<table class="top_info">
<tr>
<td class="image">
<div style="background-image:url('/favicon.png')"></div>
</td>
<td class="text">
<h1>Maloja</h1><br/>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<p class="desc">Welcome to your own Maloja server!</p>
</td>
</tr>
</table>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<h2>Start Scrobbling</h2>
2019-03-24 16:56:34 +03:00
If you use Vivaldi, Brave, Iridium or any other Chromium-based browser and listen to music on Plex or YouTube Music, download the extension and simply enter the server URL as well as your API key in the relevant fields. They will turn green if the server is accessible.
2019-03-04 19:39:21 +03:00
<br/><br/>
You can also use any standard-compliant scrobbler. For GNUFM (audioscrobbler) scrobblers, enter <span class="stats"><span name="serverurl">yourserver.tld</span>/api/s/audioscrobbler</span> as your Gnukebox server and your API key as the password. For Listenbrainz scrobblers, use <span class="stats"><span name="serverurl">yourserver.tld</span>/api/s/listenbrainz</span> as the API URL and your API key as token.
<br/><br/>
2019-03-04 19:39:21 +03:00
If you use another browser or another music player, you could try to code your own extension. The API is super simple! Just send a POST HTTP request to
2019-03-24 16:56:34 +03:00
<span class="stats"><span name="serverurl">yourserver.tld</span>/api/newscrobble</span>
2019-03-04 19:39:21 +03:00
(make sure to use the public URL) with the key-value-pairs
<br/>
<br/>
2019-03-24 18:19:45 +03:00
<table class="misc">
2019-03-04 19:39:21 +03:00
<tr> <td>artist</td> <td><i>Artist String</i></td> </tr>
<tr> <td>title</td> <td><i>Title String</i></td> </tr>
<tr> <td>key</td> <td><i>API Key</i></td> </tr>
<tr> <td>seconds</td> <td><i>Duration of Scrobble - optional and currently not used</i></td> </tr>
</table>
2019-05-14 14:04:05 +03:00
<br/><br/>
Finally, you could always <a class="textlink" href="/manual">manually scrobble</a>!
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<br/><br/>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<h2>Import your Last.FM data</h2>
2019-03-24 16:56:34 +03:00
2019-03-25 20:13:12 +03:00
Switching from Last.fm? <a class="textlink" href="https://benjaminbenben.com/lastfm-to-csv/">Download all your data</a> and run the command <span class="stats">maloja import <i>(the file you just downloaded)</i></span>.
2019-03-04 19:39:21 +03:00
<br/><br/>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<h2>Set up some rules</h2>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
After you've scrobbled for a bit, you might want to check the <a class="textlink" href="/issues">Issues page</a> to see if you need to set up some rules. You can also manually add rules in your server's "rules" directory - just add your own .tsv file and read the instructions on how to declare a rule.
<br/><br/>
2019-03-24 16:56:34 +03:00
2019-03-24 18:04:44 +03:00
You can also set up some predefined rulesets right away! Enter your API key and click the buttons.
<br/>
API Key:
<input id='apikey' onchange='checkAPIkey()' style='width:300px;'/>
2019-03-24 16:56:34 +03:00
<br/><br/>
KEY_PREDEFINED_RULESETS
<br/><br/>
2019-03-04 19:39:21 +03:00
<h2>Say thanks</h2>
2019-03-24 16:56:34 +03:00
Coding open source projects is fun, but not really monetizable. If you like Maloja, I would appreciate a small donation via
2019-03-04 19:39:21 +03:00
<a class="textlink" target="_blank" rel="noopener noreferrer" href="https://paypal.me/krateng">PayPal</a> or <a class="textlink" href="bitcoin:1krat8JMniJBTiHftMfR1LtF3Y1w5DAxx">Bitcoin</a>.
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<br/><br/>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
<h2>View your stats</h2>
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
Done! Visit <a class="textlink" href="/"><span name="serverurl">yourserver.tld</span></a> (or your public / proxy URL) to look at your overview page. Almost everything is clickable!
2019-03-24 16:56:34 +03:00
2019-03-04 19:39:21 +03:00
</body>
2019-03-24 18:04:44 +03:00
2019-03-04 19:39:21 +03:00
</html>