From ce35aa939b7ed21bca7e03aa257a02992b525c7c Mon Sep 17 00:00:00 2001
From: Johann150
Date: Tue, 9 Nov 2021 09:23:22 +0100
Subject: [PATCH] add misskey to web pages
---
assets/instance_buttons.js | 29 +++++++++++------
templates/about.html | 63 ++++++++++++++++++++++++++++++++++--
templates/misskey_login.html | 29 +++++++++++++++++
3 files changed, 108 insertions(+), 13 deletions(-)
create mode 100644 templates/misskey_login.html
diff --git a/assets/instance_buttons.js b/assets/instance_buttons.js
index 6c2bfc1..0b152cc 100644
--- a/assets/instance_buttons.js
+++ b/assets/instance_buttons.js
@@ -3,13 +3,22 @@ import {SLOTS, normalize_known, known_load, known_save} from './known_instances.
(function instance_buttons(){
const container = document.querySelector('#mastodon_instance_buttons');
- const button_template = Function('first', 'instance',
- 'return `' + document.querySelector('#instance_button_template').innerHTML + '`;');
- const another_button_template = Function(
+ const mastodon_button_template = Function('first', 'instance',
+ 'return `' + document.querySelector('#mastodon_instance_button_template').innerHTML + '`;');
+ const mastodon_another_button_template = Function(
'return `' +
- document.querySelector('#another_instance_button_template').innerHTML + '`;');
- const top_instances =
- Function('return JSON.parse(`' + document.querySelector('#top_instances').innerHTML + '`);')();
+ document.querySelector('#mastodon_another_instance_button_template').innerHTML + '`;');
+ const mastodon_top_instances =
+ Function('return JSON.parse(`' + document.querySelector('#mastodon_top_instances').innerHTML + '`);')();
+
+ const misskey_container = document.querySelector('#misskey_instance_buttons');
+ const misskey_button_template = Function('first', 'instance',
+ 'return `' + document.querySelector('#misskey_instance_button_template').innerHTML + '`;');
+ const misskey_another_button_template = Function(
+ 'return `' +
+ document.querySelector('#misskey_another_instance_button_template').innerHTML + '`;');
+ const misskey_top_instances =
+ Function('return JSON.parse(`' + document.querySelector('#misskey_top_instances').innerHTML + '`);')();
async function get_known(){
let known = known_load();
@@ -39,7 +48,7 @@ import {SLOTS, normalize_known, known_load, known_save} from './known_instances.
known_save(known);
let filtered_top_instances = []
- for(let instance of top_instances){
+ for(let instance of mastodon_top_instances){
let found = false;
for(let k of known){
if(k['instance'] == instance['instance']){
@@ -58,13 +67,13 @@ import {SLOTS, normalize_known, known_load, known_save} from './known_instances.
let first = true;
for(let instance of instances){
- html += button_template(first, instance['instance'])
+ html += mastodon_button_template(first, instance['instance'])
first = false;
}
- html += another_button_template();
+ html += mastodon_another_button_template();
- container.innerHTML = html;
+ mastodon_container.innerHTML = html;
}
replace_buttons();
diff --git a/templates/about.html b/templates/about.html
index ede9d57..935b383 100644
--- a/templates/about.html
+++ b/templates/about.html
@@ -46,9 +46,35 @@
{% endif %}
+
+
+
+{% for instance in misskey_instances %}
+
+{% if loop.first %}
+ {{picture(st, 'misskey', (20,40,80), ('webp', 'png'))}}
+ Log in with
+{% endif %}
+ {{instance}}
+
+{% else %}
+
+ {{picture(st, 'misskey', (20,40,80), ('webp', 'png'))}}
+ Log in with Misskey
+
+{% endfor %}
+
+
+{% if misskey_instances %}
+
+ Another Misskey instance
+
+{% endif %}
+
+
-
-
+
+
+
+
+
+
+
+
+
{% endif %}
@@ -86,7 +143,7 @@
- Delete your posts when they cross an age threshold.
- Or keep your post count in check, deleting old posts when you go over.
- - Preserve old posts that matter by giving them a favourite.
+ - Preserve old posts that matter by giving them a favourite or a reaction (Misskey only).
- Set it and forget it. Forget works continuously in the background.
diff --git a/templates/misskey_login.html b/templates/misskey_login.html
new file mode 100644
index 0000000..c830078
--- /dev/null
+++ b/templates/misskey_login.html
@@ -0,0 +1,29 @@
+{% extends 'lib/layout.html' %}
+{% block body %}
+
+ Log in with Misskey
+
+{% if generic_error %}
+ Something went wrong while logging in. Try again?
+{% endif %}
+
+{% if address_error %}
+ This doesn't look like a misskey instance url. Try again?
+{% endif %}
+
+
+
+
+
+{% endblock %}