Meta: Add files to repository
This commit is contained in:
parent
6d27d43268
commit
52cb92f587
120 changed files with 71820 additions and 0 deletions
117
Slon/Static/css/main.css
Normal file
117
Slon/Static/css/main.css
Normal file
File diff suppressed because one or more lines are too long
8
Slon/Static/defaults/account.json
Normal file
8
Slon/Static/defaults/account.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"username": "",
|
||||
"display_name": "",
|
||||
"email": "",
|
||||
"note": "",
|
||||
"avatar": "",
|
||||
"header": ""
|
||||
}
|
44
Slon/Static/defaults/actor.json
Normal file
44
Slon/Static/defaults/actor.json
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"featured": {
|
||||
"@id": "toot:featured",
|
||||
"@type": "@id"
|
||||
},
|
||||
"featuredTags": {
|
||||
"@id": "toot:featuredTags",
|
||||
"@type": "@id"
|
||||
},
|
||||
"alsoKnownAs": {
|
||||
"@id": "as:alsoKnownAs",
|
||||
"@type": "@id"
|
||||
},
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"schema": "http://schema.org#",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"value": "schema:value",
|
||||
"discoverable": "toot:discoverable",
|
||||
"suspended": "toot:suspended",
|
||||
"memorial": "toot:memorial",
|
||||
"indexable": "toot:indexable",
|
||||
"attributionDomains": {
|
||||
"@id": "toot:attributionDomains",
|
||||
"@type": "@id"
|
||||
}
|
||||
}
|
||||
],
|
||||
"type": "Person",
|
||||
"manuallyApprovesFollowers": false,
|
||||
"discoverable": false,
|
||||
"indexable": false,
|
||||
"memorial": false,
|
||||
"tag": [],
|
||||
"endpoints": {}
|
||||
}
|
14
Slon/Static/defaults/instance.json
Normal file
14
Slon/Static/defaults/instance.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"uri": "error.checksum.fail",
|
||||
"title": "error.checksum.fail",
|
||||
"short_description": "A fediverse instance running on TempleOS",
|
||||
"description": "A fediverse instance running on TempleOS",
|
||||
"email": "alec@checksum.fail",
|
||||
"version": "1.0.0",
|
||||
"registrations": false,
|
||||
"stats": {
|
||||
"user_count": 0,
|
||||
"status_count": 0,
|
||||
"domain_count": 0
|
||||
}
|
||||
}
|
168
Slon/Static/html/admin/main.html
Normal file
168
Slon/Static/html/admin/main.html
Normal file
|
@ -0,0 +1,168 @@
|
|||
<!doctypehtml>
|
||||
<link href=https://cdn.jsdelivr.net/npm/bulma@1.0.3/css/bulma.min.css rel=stylesheet>
|
||||
<style>
|
||||
body {
|
||||
padding: 32px
|
||||
}
|
||||
|
||||
.container-x {
|
||||
width: 640px
|
||||
}
|
||||
|
||||
.next {
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 16px
|
||||
}
|
||||
|
||||
.main-content {
|
||||
padding-left: 32px;
|
||||
width: 100%;
|
||||
vertical-align: top
|
||||
}
|
||||
|
||||
.menu {
|
||||
width: 240px
|
||||
}
|
||||
</style>
|
||||
<aside class="menu is-inline-block">
|
||||
<p class="menu-label">Info</p>
|
||||
<ul class="menu-list">
|
||||
<li><a onclick="infoStats()" id="menuitem-stats">Statistics</a></li>
|
||||
</ul>
|
||||
<p class="menu-label">Manage</p>
|
||||
<ul class="menu-list">
|
||||
<li><a onclick="manageAccounts()" id="menuitem-accounts">Accounts</a></li>
|
||||
<li><a onclick="manageInstance()" id="menuitem-instance">Instance</a></li>
|
||||
</ul>
|
||||
<p class="menu-label">Diagnostics</p>
|
||||
<ul class="menu-list">
|
||||
<li><a onclick="diagsLogs()" id="menuitem-logs">Logs</a></li>
|
||||
</ul>
|
||||
</aside>
|
||||
<div id="content" class="container main-content is-inline-block">
|
||||
</div>
|
||||
<script>
|
||||
function clearActiveLinks() {
|
||||
document.querySelectorAll("a").forEach(function (a) { a.className = ""; });
|
||||
}
|
||||
function setActiveLink(link) {
|
||||
document.getElementById("menuitem-" + link).className = "is-active";
|
||||
}
|
||||
function setContent(html) {
|
||||
document.getElementById("content").innerHTML = html;
|
||||
}
|
||||
async function infoStats() {
|
||||
clearActiveLinks();
|
||||
const request = new Request("/info/stats");
|
||||
const response = await fetch(request);
|
||||
const stats = await response.json();
|
||||
let html = "<h4 class=\"title is-4\">Statistics</h4><div class=spacer></div><div>Uptime: " + formatTime(stats["uptime"]) + "</div>";
|
||||
setContent(html);
|
||||
setActiveLink("stats");
|
||||
}
|
||||
async function manageAccounts() {
|
||||
clearActiveLinks();
|
||||
const request = new Request("/manage/accounts");
|
||||
const response = await fetch(request);
|
||||
const accounts = await response.json();
|
||||
let html = "<h4 class=\"title is-4\">Accounts</h4><div class=spacer></div>";
|
||||
if (accounts.length) {
|
||||
html += "<table class=table><thead><tr><th>id</th><th>username</th></tr></head><tbody>";
|
||||
for (let i = 0; i < accounts.length; i++) {
|
||||
html += "<tr><td>" + accounts[i]["id"] + "</td><td>" + accounts[i]["username"] + "</td><tr>";
|
||||
}
|
||||
html += "</tbody></table>";
|
||||
} else {
|
||||
html += "No users";
|
||||
}
|
||||
html += "<br><br><input onclick=manageNewUser() class=button type=button value=\"New User\">";
|
||||
setContent(html);
|
||||
setActiveLink("accounts");
|
||||
}
|
||||
function manageNewUser() {
|
||||
clearActiveLinks();
|
||||
let html = "<h4 class=\"title is-4\">New User</h4><div class=spacer></div>";
|
||||
|
||||
html += "<form action=\"javascript:saveNewUser()\"><div>";
|
||||
|
||||
html += "<div class=\"section is-inline-block\" style=\"width:420px;vertical-align:top\">";
|
||||
html += "<label class=label>Username</label><div class=control><input id=username class=input placeholder=baoh required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "<label class=label>Display Name</label><div class=control><input id=display_name class=input placeholder=\"Ikuro Hashizawa\" required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "<label class=label>Email</label><div class=control><input id=email class=input type=email placeholder=\"cooldude42069@checksum.fail\" required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "<label class=label>Bio</label><div class=control><input id=bio class=input placeholder=\"ima firin mah lazer cannon\" required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "</div>";
|
||||
html += "<div class=\"section is-inline-block\" style=\"width:420px;vertical-align:top\">";
|
||||
html += "<label class=label>Avatar</label><div class=control><input id=avatar class=input placeholder=\"https://full.path.to/my/avatar.png\" required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "<label class=label>Header</label><div class=control><input id=header class=input placeholder=\"https://full.path.to/my/header.png\" required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "<label class=label>Private Key (must be in DER format)</label><div class=control><input onchange=updateBase64(this) id=privatekey type=file required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "<label class=label>Public Key (must be in PEM format)</label><div class=control><input onchange=updateBase64(this) id=publickey type=file required autocomplete=off></div><div class=spacer></div>";
|
||||
html += "</div>";
|
||||
|
||||
html += "</div>";
|
||||
html += "<div class=\"control next\"><input class=\"button is-link\" type=submit value=Save></div>"
|
||||
html += "</div></form>";
|
||||
|
||||
setContent(html);
|
||||
setActiveLink("accounts");
|
||||
}
|
||||
async function saveNewUser() {
|
||||
let data = {};
|
||||
let fields = document.getElementsByTagName("input");
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
switch (fields[i].type) {
|
||||
case "checkbox":
|
||||
data[fields[i].id] = fields[i].checked;
|
||||
break;
|
||||
case "file":
|
||||
data[fields[i].id] = fields[i].base64;
|
||||
break;
|
||||
case "submit":
|
||||
break;
|
||||
default:
|
||||
data[fields[i].id] = fields[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const request = new Request("/new/account", {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
method: "POST",
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
const response = await fetch(request);
|
||||
const json = await response.json();
|
||||
if (!Object.keys(json).length) {
|
||||
manageAccounts();
|
||||
} else {
|
||||
alert(JSON.stringify(json));
|
||||
}
|
||||
}
|
||||
function updateBase64(el) {
|
||||
let reader = new FileReader();
|
||||
reader.readAsDataURL(el.files[0]);
|
||||
reader.addEventListener(
|
||||
"load",
|
||||
() => {
|
||||
el.base64 = reader.result.split(";base64,")[1];
|
||||
}
|
||||
);
|
||||
}
|
||||
const formatTime = milliseconds => {
|
||||
const seconds = Math.floor((milliseconds / 1000) % 60);
|
||||
const minutes = Math.floor((milliseconds / 1000 / 60) % 60);
|
||||
const hours = Math.floor((milliseconds / 1000 / 60 / 60) % 24);
|
||||
return [
|
||||
hours.toString().padStart(2, "0"),
|
||||
minutes.toString().padStart(2, "0"),
|
||||
seconds.toString().padStart(2, "0")
|
||||
].join(":");
|
||||
}
|
||||
addEventListener("DOMContentLoaded", (event) => {
|
||||
infoStats();
|
||||
})
|
||||
document.querySelectorAll("input[type=file]").forEach(function (e) {
|
||||
a.className = "";
|
||||
});
|
||||
</script>
|
83
Slon/Static/html/admin/setup_instance.html
Normal file
83
Slon/Static/html/admin/setup_instance.html
Normal file
|
@ -0,0 +1,83 @@
|
|||
<!doctypehtml>
|
||||
<link href=https://cdn.jsdelivr.net/npm/bulma@1.0.3/css/bulma.min.css rel=stylesheet>
|
||||
<style>
|
||||
body {
|
||||
padding: 32px
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 640px
|
||||
}
|
||||
|
||||
.next {
|
||||
text-align: right
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 16px
|
||||
}
|
||||
</style>
|
||||
<div class=container>
|
||||
<nav class=panel>
|
||||
<form action="javascript:setupInstance()">
|
||||
<p class=panel-heading>Setup
|
||||
<div class=section>
|
||||
<p>Enter the following information to set up your Slon instance.
|
||||
<div class=spacer></div>
|
||||
<label class=label>URI</label>
|
||||
<div class=control><input id=uri class=input placeholder=my-slon-instance.foo required
|
||||
autocomplete=off></div>
|
||||
<div style=height:16px></div>
|
||||
|
||||
<label class=label>Title</label>
|
||||
<div class=control><input id=title class=input placeholder="My Slon Instance" required
|
||||
autocomplete=off></div>
|
||||
<div class=spacer></div>
|
||||
|
||||
<label class=label>Description</label>
|
||||
<div class=control><input id=description class=input
|
||||
placeholder="A fediverse instance running on TempleOS" required autocomplete=off></div>
|
||||
<div class=spacer></div>
|
||||
|
||||
<label class=label>Administrator Email</label>
|
||||
<div class=control><input id=email class=input placeholder=alec@checksum.fail required type=email
|
||||
autocomplete=off>
|
||||
</div>
|
||||
<div class=spacer></div>
|
||||
|
||||
<label class=checkbox><input id=registrations type=checkbox> Enable
|
||||
registrations</label>
|
||||
<div class="control next"><input class="button is-link" type=submit value=Next></div>
|
||||
</div>
|
||||
</form>
|
||||
</nav>
|
||||
</div>
|
||||
<script>
|
||||
addEventListener("DOMContentLoaded", (event) => {
|
||||
document.getElementById("uri").focus();
|
||||
})
|
||||
async function setupInstance() {
|
||||
let data = {};
|
||||
let fields = document.getElementsByTagName("input");
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
switch (fields[i].type) {
|
||||
case "checkbox":
|
||||
data[fields[i].id] = fields[i].checked;
|
||||
break;
|
||||
case "submit":
|
||||
break;
|
||||
default:
|
||||
data[fields[i].id] = fields[i].value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const request = new Request("/setup/instance", {
|
||||
headers: { "Content-Type": "application/json" },
|
||||
method: "POST",
|
||||
body: JSON.stringify(data)
|
||||
});
|
||||
const response = await fetch(request);
|
||||
const json = await response.json();
|
||||
window.location = "/";
|
||||
}
|
||||
</script>
|
29
Slon/Static/html/user.html
Normal file
29
Slon/Static/html/user.html
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!doctypehtml>
|
||||
<title></title>
|
||||
<link href=https://error.checksum.fail/css/12391289038129038.css rel=stylesheet>
|
||||
<link href=https://linusg.github.io/serenityos-emoji-font/SerenityOS-Emoji.css rel=stylesheet>
|
||||
<style>
|
||||
* {
|
||||
font-family: "SerenityOS Emoji", "TempleOS", -apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif
|
||||
}
|
||||
|
||||
.pix {
|
||||
image-rendering: pixelated
|
||||
}
|
||||
</style>
|
||||
<div class=page-container>
|
||||
<div class=page-header></div>
|
||||
<div class=page-content>
|
||||
<br>
|
||||
<br>
|
||||
<center><font style="color: #fff">Loading Statuses...</font><img class="text-cursor"></center>
|
||||
<br>
|
||||
</div>
|
||||
<div class=page-footer>This server is powered by <a href=https://slon-project.org>Slon</a>, a
|
||||
Mastodon-compatible fediverse instance for TempleOS, written in HolyC</div>
|
||||
</div>
|
||||
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/dayjs.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/dayjs@1/plugin/relativeTime.js"></script>
|
||||
<script>dayjs.extend(window.dayjs_plugin_relativeTime)</script>
|
||||
<script src=https://error.checksum.fail/js/header.js></script>
|
||||
<script src=https://error.checksum.fail/js/12389290138092193.js></script>
|
3
Slon/Static/js/header.js
Normal file
3
Slon/Static/js/header.js
Normal file
|
@ -0,0 +1,3 @@
|
|||
let lastFrameTime=0,fps=0;function calculateFPS(){requestAnimationFrame(()=>{const a=performance.now();fps=1E3/(a-lastFrameTime);lastFrameTime=a;calculateFPS()})}
|
||||
function updatePageHeader(){var a=new Date,c=a.toString().substring(0,3);const d=String(a.getMonth()+1).padStart(2,"0"),e=String(a.getDate()).padStart(2,"0");a=a.toString().substring(16,24);const f="CPU <b>"+(10*Math.random()).toFixed(0)+"</b>";if(navigator.userAgent.toLowerCase().includes("firefox"))var b=3735929054;else b=performance.memory,b=b.jsHeapSizeLimit-b.usedJSHeapSize;c=c+" "+d+"/"+e+" "+a+" FPS:"+fps.toFixed(0)+" Mem:"+b.toString(16).toUpperCase()+" "+f;document.getElementsByClassName("page-header")[0].innerHTML=
|
||||
c}calculateFPS();updatePageHeader();setInterval(updatePageHeader,300);
|
132
Slon/Static/js/statuses.js
Normal file
132
Slon/Static/js/statuses.js
Normal file
|
@ -0,0 +1,132 @@
|
|||
function updateStatusContainers() {
|
||||
let els = document.getElementsByClassName('status-container');
|
||||
for (var n = 0; n < els.length; n++) {
|
||||
let pc = els[n];
|
||||
let post_html = ""
|
||||
|
||||
let horizontal_fill_count = ((pc.offsetWidth - 32) / 16);
|
||||
let url = pc.getElementsByTagName('url')[0].textContent;
|
||||
let marqueeHref = url == "Unnamed Task" ? window.location : url;
|
||||
|
||||
post_html += "<b>\u2554";
|
||||
for (var i = 0; i < (horizontal_fill_count / 2) - ((240 / 16) / 2); i++) {
|
||||
post_html += "\u2550";
|
||||
}
|
||||
|
||||
post_html += "<a href=\"" + marqueeHref + "\"><marquee scrollamount=16>" + url + "...</marquee></a>";
|
||||
for (var i = 0; i < (horizontal_fill_count / 2) - ((240 / 16) / 2) - 2; i++) {
|
||||
post_html += "\u2550";
|
||||
}
|
||||
post_html += "[X]\u2557<br></b>";
|
||||
|
||||
let height = Math.ceil(pc.getElementsByClassName('status-content')[0].offsetHeight / 16);
|
||||
let desc = "Term";
|
||||
|
||||
for (var y = 0; y < height; y++) {
|
||||
let ch = y < 4 ? desc[y] : "\u2551";
|
||||
post_html += "<b>" + ch + "<div style=\"display: inline-block; height: 16px; width: " + ((horizontal_fill_count + 1) * 16).toString() + "px\"></div>\u2551</b><br>";
|
||||
}
|
||||
|
||||
post_html += "<b>\u255a";
|
||||
for (var i = 0; i < (horizontal_fill_count + 1); i++) {
|
||||
post_html += "\u2550";
|
||||
}
|
||||
post_html += "\u255d<br></b>";
|
||||
|
||||
pc.innerHTML += post_html;
|
||||
pc.style.display = "inline";
|
||||
}
|
||||
}
|
||||
|
||||
function smolDate(a){return a.split(" ago")[0].replace("a ","1").replace("an ","1").replace("days","d").replace("day","d").replace("hours","h").replace("hour","h").replace("minutes","m").replace("minute","m").replace("seconds","s").replace("second","s").replace("few","").replace(" ","")};
|
||||
|
||||
function updateStatuses(user, statuses) {
|
||||
let pageContent = document.getElementsByClassName("page-content")[0];
|
||||
let elements = document.createElement('div');
|
||||
|
||||
let container = document.createElement('div');
|
||||
container.className = "status-container";
|
||||
// Render user profile
|
||||
{
|
||||
let content = document.createElement('div');
|
||||
content.className = "status-content";
|
||||
let content_html = "";
|
||||
content_html += "<div class=status-avatar style=margin:16px;background:url(" + user["icon"]["url"] + ");width:72px;height:72px;background-size:contain;background-repeat:no-repeat></div>";
|
||||
content_html += "<div class=status-header>" + user["preferredUsername"] + "<br><a href=" + user["url"] + ">@" + user["preferredUsername"] + "@" + location.host + "</a></div>"
|
||||
content_html += "<div class=status-text><font style=color:#0>" + user["summary"] + "</font></div>";
|
||||
content_html += "<div class=status-text>Joined " + new Date(Date.parse(user["published"])).toString().substr(0,15) + "</div>";
|
||||
content.innerHTML = content_html;
|
||||
let url = document.createElement('url');
|
||||
url.textContent = window.location;
|
||||
let menuImg = document.createElement('img');
|
||||
menuImg.className = "text-menu";
|
||||
content.appendChild(menuImg);
|
||||
container.appendChild(content);
|
||||
container.appendChild(url);
|
||||
elements.appendChild(container);
|
||||
let spacer = document.createElement('div');
|
||||
spacer.style.height = "16px";
|
||||
elements.appendChild(spacer);
|
||||
}
|
||||
|
||||
elements.className = "statuses";
|
||||
statuses.sort((a,b) => b.id - a.id);
|
||||
for (var i = 0; i < statuses.length; i++) {
|
||||
let status = statuses[i];
|
||||
let container = document.createElement('div');
|
||||
container.className = "status-container";
|
||||
let content = document.createElement('div');
|
||||
content.className = "status-content";
|
||||
let content_html = "";
|
||||
if (status["visibility"] == "public") {
|
||||
content_html += "<span title=Public>🌎</span> ";
|
||||
}
|
||||
content_html += "<span class=status-timestamp>" + smolDate(dayjs(status["created_at"]).fromNow()) + "</span><br></div>";
|
||||
content_html += "<div class=status-text>" + status["content"] + "</div>";
|
||||
content_html += "<span class=status-counts>💬 " + status["replies_count"] + " 🔁 " + status["reblogs_count"] + " ⭐ " + status["favourites_count"] + "</span>";
|
||||
content_html += "<div class=status-footer>via <a href=" + status["application"]["website"] + ">" + status["application"]["name"] + "</a></div>";
|
||||
content.innerHTML = content_html;
|
||||
let url = document.createElement('url');
|
||||
url.textContent = status["url"];
|
||||
let menuImg = document.createElement('img');
|
||||
menuImg.className = "text-menu";
|
||||
content.appendChild(menuImg);
|
||||
container.appendChild(content);
|
||||
container.appendChild(url);
|
||||
elements.appendChild(container);
|
||||
if (i < statuses.length - 1) {
|
||||
let spacer = document.createElement('div');
|
||||
spacer.style.height = "16px";
|
||||
elements.appendChild(spacer);
|
||||
}
|
||||
}
|
||||
if (!statuses.length) {
|
||||
let container = document.createElement('div');
|
||||
container.className = "status-container";
|
||||
let content = document.createElement('div');
|
||||
content.className = "status-content";
|
||||
let content_html = "";
|
||||
content_html += "<div class=nostatus><font style=color:#0000a8>&FileRead &StatusRead &StatusPrint &ExeCmdLine <img class=text-error> No statuses found.\n " + Math.random().toFixed(6) + "s ans=0x00000000=0<br>C:/Home><img class=text-cursor></font></div>";
|
||||
content.innerHTML = content_html;
|
||||
let url = document.createElement('url');
|
||||
url.textContent = "Unnamed Task";
|
||||
let menuImg = document.createElement('img');
|
||||
menuImg.className = "text-menu";
|
||||
content.appendChild(menuImg);
|
||||
container.appendChild(content);
|
||||
container.appendChild(url);
|
||||
elements.appendChild(container);
|
||||
}
|
||||
pageContent.innerHTML = "";
|
||||
pageContent.appendChild(elements);
|
||||
updateStatusContainers();
|
||||
}
|
||||
|
||||
function getStatuses(user) {
|
||||
fetch("https://error.checksum.fail/api/v1/accounts/" + user["accountId"] + "/statuses", {
|
||||
method: 'GET',
|
||||
headers: {'Accept': 'application/json' }
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => updateStatuses(user, data));
|
||||
}
|
12
Slon/Static/oauth/authorize.html
Normal file
12
Slon/Static/oauth/authorize.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<html>
|
||||
|
||||
<body>
|
||||
<script src="https://cdn.jsdelivr.net/gh/IdentityModel/oidc-client-js@1.8/dist/oidc-client.min.js"></script>
|
||||
<script>
|
||||
var retry_count = 0, retry_timeout = 2E3; function retryVerifyAccess() { 3 < ++retry_count ? alert("Retry limit exceeded") : setTimeout(verifyAccess, retry_timeout) }
|
||||
async function verifyAccess() { try { var b = localStorage.getItem("authorize"); if (null != b) { const a = await fetch("https://" + window.location.host + "/oauth/verify_access?" + b + window.location.hash.substring(1)); if (a.ok) { const c = await a.json(); window.location = c.redirect_uri } else 202 == a.status ? retryVerifyAccess() : alert("Unexpected response status: " + a.status.toString()) } } catch (a) { retryVerifyAccess() } }
|
||||
var settings = { authority: "https://app.simplelogin.io/", client_id: "templeosfediverseserver-yssuxmkust", response_type: "id_token token", scope: "openid", redirect_uri: "https://" + window.location.host + "/oauth/authorize" }, mgr = new Oidc.UserManager(settings); window.location.search && localStorage.setItem("authorize", window.location.search.replace("?", "").replace("state", "client_state") + "&"); window.location.hash ? verifyAccess() : mgr.signinRedirect();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue