Added Peertube to known platforms.

This commit is contained in:
Stefan Bohacek 2024-07-28 11:09:36 -04:00
parent 9bcb681d55
commit 6f487f7858
No known key found for this signature in database
GPG key ID: FC75CD588A42BC10
3 changed files with 9 additions and 1 deletions

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="512px" height="512px" viewBox="0 0 512 512" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>PeerTube</title>
<g id="PeerTube" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path d="M63,0 L257,128.512046 L256.886,128.587 L450,256.512046 L256,385 L256,384.174 L63,512 L63,0 Z M256,129.174 L64.51,256 L256,382.85 L256,129.174 Z" id="Path-2" fill="#000000" fill-rule="nonzero"></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 533 B

View file

@ -19,6 +19,7 @@
"misskey",
"misty",
"osada",
"peertube",
"pixelfed",
"pleroma",
"sharkey",

View file

@ -1 +1 @@
(async()=>{const knownSoftware=["calckey","diaspora","ecko","firefish","friendica","glitch-soc","gnu_social","gotosocial","groundpolis","hometown","hubzilla","kepi","lemmy","mastodon","misskey","misty","osada","pixelfed","pleroma","sharkey","socialhome","threads","wordpress","xmpp","zap"];const supportedSoftware=["diaspora","firefish","friendica","glitch-soc","hometown","hubzilla","lemmy","mastodon","misskey","sharkey","threads"];const getFSBPath=()=>{var scripts=document.getElementsByClassName("fsb-script")[0];src=scripts.src;return src.replace("/script.min.js","")};const updateTheIcon=(iconElement,software)=>{const domainInput=iconElement.parentElement.parentElement.parentElement.getElementsByClassName("fsb-domain")[0];const supportNote=iconElement.parentElement.parentElement.parentElement.getElementsByClassName("fsb-support-note")[0];const supportNoteLink=iconElement.parentElement.parentElement.parentElement.getElementsByClassName("fsb-support-note-link")[0];iconElement.src=`${getFSBPath()}/icons/${software}.svg`;iconElement.alt=`${software} platform logo`;supportNote.classList.add("fsb-d-none");if(domainInput.value&&domainInput.value.trim().length>0&&!supportedSoftware.includes(software)){supportNoteLink.href=`https://${domainInput.value}`;supportNoteLink.innerHTML=domainInput.value;supportNote.classList.remove("fsb-d-none")}};const updateIcon=async domainInput=>{clearTimeout(typingTimer);if(domainInput.value){typingTimer=setTimeout((()=>{doneTyping(domainInput)}),doneTypingInterval)}else{const iconEl=domainInput.parentElement.getElementsByClassName("fsb-icon")[0];updateTheIcon(iconEl,"mastodon")}};const doneTyping=async el=>{const shareBtn=el.parentElement.getElementsByClassName("fsb-button")[0];const domain=getDomain(el.value);shareBtn.disabled=true;const resp=await fetch(`https://fediverse-info.stefanbohacek.dev/node-info?domain=${domain}`);const respJSON=await resp.json();const software=respJSON?.software?.name;const iconEl=el.parentElement.getElementsByClassName("fsb-icon")[0];el.dataset.software=software;if(software){localStorage.setItem("fsb-software",software)}if(software&&knownSoftware.includes(software)){updateTheIcon(iconEl,software)}else{updateTheIcon(iconEl,"question")}shareBtn.disabled=false};const getPageTitle=()=>{let pageTitle=document.title;try{pageTitle=document.querySelector("meta[property='og:title']").getAttribute("content")}catch(error){}return encodeURIComponent(pageTitle)};const getPageDescription=()=>{let pageDescription="";const metaDescription=document.querySelector("meta[name='description']")||document.querySelector("meta[property='og:description']")||null;if(metaDescription&&metaDescription.getAttribute){pageDescription=metaDescription.getAttribute("content")}return encodeURIComponent(pageDescription)};const getPageURL=()=>encodeURIComponent(window.location.href);const getDomain=str=>str.replace(/(^\w+:|^)\/\//,"");const truncate=input=>input.length>5?`${input.substring(0,450)}...`:input;const getSelectedText=()=>{let text="";if(window.getSelection){text=window.getSelection().toString()}else if(document.selection&&document.selection.type!="Control"){text=document.selection.createRange().text}return truncate(text)};let typingTimer;const doneTypingInterval=1300;const savedDomain=localStorage.getItem("fsb-domain");const savedSoftware=localStorage.getItem("fsb-software");[...document.getElementsByClassName("fsb-prompt")].forEach((fsbPrompt=>{const domainInput=fsbPrompt.getElementsByClassName("fsb-domain")[0];const shareBtn=fsbPrompt.getElementsByClassName("fsb-button")[0];if(savedDomain){domainInput.value=savedDomain;if(savedSoftware){domainInput.dataset.software=savedSoftware;const iconEl=domainInput.parentElement.getElementsByClassName("fsb-icon")[0];updateTheIcon(iconEl,savedSoftware)}else{updateIcon(domainInput)}}domainInput.addEventListener("input",(()=>{updateIcon(domainInput)}));domainInput.addEventListener("change",(()=>{}));fsbPrompt.addEventListener("submit",(ev=>{ev.preventDefault();const domain=getDomain(domainInput?.value?.trim());if(domain?.length){const shareText=getSelectedText()||getPageTitle();localStorage.setItem("fsb-domain",domain);let shareURL=`https://${domain}/share?text=${shareText+"%0A%0A"+getPageURL()}`;if(domainInput?.dataset?.software){if(["diaspora","friendica"].includes(domainInput.dataset.software)){shareURL=`https://${domain}/bookmarklet?url=${getPageURL()}&title=${shareText}&note=${getPageDescription()}`}else if(domainInput.dataset.software==="hubzilla"){shareURL=`https://${domain}/rpost?url=${getPageURL()}&body=${shareText}[br][br]`}else if(domainInput.dataset.software==="threads"){shareURL=`https://${domain}/intent/post?text=${shareText+"%0A%0A"+getPageURL()}`}}window.location.assign(shareURL)}}))}))})();
(async()=>{const knownSoftware=["calckey","diaspora","ecko","firefish","friendica","glitch-soc","gnu_social","gotosocial","groundpolis","hometown","hubzilla","kepi","lemmy","mastodon","misskey","misty","osada","peertube","pixelfed","pleroma","sharkey","socialhome","threads","wordpress","xmpp","zap"];const supportedSoftware=["diaspora","firefish","friendica","glitch-soc","hometown","hubzilla","lemmy","mastodon","misskey","sharkey","threads"];const getFSBPath=()=>{var scripts=document.getElementsByClassName("fsb-script")[0];src=scripts.src;return src.replace("/script.min.js","")};const updateTheIcon=(iconElement,software)=>{const domainInput=iconElement.parentElement.parentElement.parentElement.getElementsByClassName("fsb-domain")[0];const supportNote=iconElement.parentElement.parentElement.parentElement.getElementsByClassName("fsb-support-note")[0];const supportNoteLink=iconElement.parentElement.parentElement.parentElement.getElementsByClassName("fsb-support-note-link")[0];iconElement.src=`${getFSBPath()}/icons/${software}.svg`;iconElement.alt=`${software} platform logo`;supportNote.classList.add("fsb-d-none");if(domainInput.value&&domainInput.value.trim().length>0&&!supportedSoftware.includes(software)){supportNoteLink.href=`https://${domainInput.value}`;supportNoteLink.innerHTML=domainInput.value;supportNote.classList.remove("fsb-d-none")}};const updateIcon=async domainInput=>{clearTimeout(typingTimer);if(domainInput.value){typingTimer=setTimeout((()=>{doneTyping(domainInput)}),doneTypingInterval)}else{const iconEl=domainInput.parentElement.getElementsByClassName("fsb-icon")[0];updateTheIcon(iconEl,"mastodon")}};const doneTyping=async el=>{const shareBtn=el.parentElement.getElementsByClassName("fsb-button")[0];const domain=getDomain(el.value);shareBtn.disabled=true;const resp=await fetch(`https://fediverse-info.stefanbohacek.dev/node-info?domain=${domain}`);const respJSON=await resp.json();const software=respJSON?.software?.name;const iconEl=el.parentElement.getElementsByClassName("fsb-icon")[0];el.dataset.software=software;if(software){localStorage.setItem("fsb-software",software)}if(software&&knownSoftware.includes(software)){updateTheIcon(iconEl,software)}else{updateTheIcon(iconEl,"question")}shareBtn.disabled=false};const getPageTitle=()=>{let pageTitle=document.title;try{pageTitle=document.querySelector("meta[property='og:title']").getAttribute("content")}catch(error){}return encodeURIComponent(pageTitle)};const getPageDescription=()=>{let pageDescription="";const metaDescription=document.querySelector("meta[name='description']")||document.querySelector("meta[property='og:description']")||null;if(metaDescription&&metaDescription.getAttribute){pageDescription=metaDescription.getAttribute("content")}return encodeURIComponent(pageDescription)};const getPageURL=()=>encodeURIComponent(window.location.href);const getDomain=str=>str.replace(/(^\w+:|^)\/\//,"");const truncate=input=>input.length>5?`${input.substring(0,450)}...`:input;const getSelectedText=()=>{let text="";if(window.getSelection){text=window.getSelection().toString()}else if(document.selection&&document.selection.type!="Control"){text=document.selection.createRange().text}return truncate(text)};let typingTimer;const doneTypingInterval=1300;const savedDomain=localStorage.getItem("fsb-domain");const savedSoftware=localStorage.getItem("fsb-software");[...document.getElementsByClassName("fsb-prompt")].forEach((fsbPrompt=>{const domainInput=fsbPrompt.getElementsByClassName("fsb-domain")[0];const shareBtn=fsbPrompt.getElementsByClassName("fsb-button")[0];if(savedDomain){domainInput.value=savedDomain;if(savedSoftware){domainInput.dataset.software=savedSoftware;const iconEl=domainInput.parentElement.getElementsByClassName("fsb-icon")[0];updateTheIcon(iconEl,savedSoftware)}else{updateIcon(domainInput)}}domainInput.addEventListener("input",(()=>{updateIcon(domainInput)}));domainInput.addEventListener("change",(()=>{}));fsbPrompt.addEventListener("submit",(ev=>{ev.preventDefault();const domain=getDomain(domainInput?.value?.trim());if(domain?.length){const shareText=getSelectedText()||getPageTitle();localStorage.setItem("fsb-domain",domain);let shareURL=`https://${domain}/share?text=${shareText+"%0A%0A"+getPageURL()}`;if(domainInput?.dataset?.software){if(["diaspora","friendica"].includes(domainInput.dataset.software)){shareURL=`https://${domain}/bookmarklet?url=${getPageURL()}&title=${shareText}&note=${getPageDescription()}`}else if(domainInput.dataset.software==="hubzilla"){shareURL=`https://${domain}/rpost?url=${getPageURL()}&body=${shareText}[br][br]`}else if(domainInput.dataset.software==="threads"){shareURL=`https://${domain}/intent/post?text=${shareText+"%0A%0A"+getPageURL()}`}}window.location.assign(shareURL)}}))}))})();