From f7f2276cecd90b54d547fc796ebf3f6b7ada7b2b Mon Sep 17 00:00:00 2001 From: codl Date: Thu, 9 Dec 2021 17:45:45 +0100 Subject: [PATCH] known_instances+misskey: actually record mk instances when logged into --- assets/settings.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/assets/settings.js b/assets/settings.js index 3b400ec..9aad005 100644 --- a/assets/settings.js +++ b/assets/settings.js @@ -194,10 +194,10 @@ import {known_load, known_save} from './known_instances.js' }) } - function bump_instance(instance_name){ + function bump_instance(service, instance_name){ let known_instances = known_load(); let found = false; - for(let instance of known_instances){ + for(let instance of known_instances[service]){ if(instance['instance'] == instance_name){ instance.hits ++; found = true; @@ -206,15 +206,17 @@ import {known_load, known_save} from './known_instances.js' } if(!found){ let instance = {"instance": instance_name, "hits": 1}; - known_instances.push(instance); + known_instances[service].push(instance); } known_save(known_instances); } - if(viewer_from_dom['service'] == 'mastodon' && location.hash == '#bump_instance'){ - bump_instance(viewer_from_dom['id'].split('@')[1]) + if(location.hash == '#bump_instance' && ( + viewer_from_dom['service'] == 'mastodon' || viewer_from_dom['service'] == 'misskey' + )){ + bump_instance(viewer_from_dom['service'], viewer_from_dom['id'].split('@')[1]) let url = new URL(location.href) url.hash = ''; history.replaceState('', '', url);