Skip to content

Commit

Permalink
feat: multiple follow options when interest created [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
akurilov committed Jul 27, 2024
1 parent fd02153 commit 2f2b4c8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 17 deletions.
21 changes: 16 additions & 5 deletions web/sub-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,19 +185,30 @@
Interest registered
</p>
<p>
Id: <span id="new-sub-id"></span>
Id: <span id="new-sub-id">1234567890abcdefghijklmnopqrstuvwxyz</span>
</p>
<button type="button"
id="sub-new-success-btn-tg"
id="sub-new-success-btn-feed"
class="flex w-full justify-center text-center"
style="display: none">
<span class="pt-1">&#10697; Follow Updates</span>
<span class="pt-1">&#10697; RSS Feed</span>
</button>
<button type="button"
id="sub-new-success-btn-feed"
id="sub-new-success-btn-ap"
class="flex w-full justify-center text-center"
style="display: none">
<span class="pt-1">&#10697; Results Feed</span>
<span class="pt-1 flex">
<svg width="16px" height="16px" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path d="M48.186 92.137c0-8.392 6.49-14.89 16.264-14.89s29.827-.225 29.827-.225-.306-6.99-.306-15.88c0-8.888 7.954-14.96 17.49-14.96 9.538 0 56.786.401 61.422.401 4.636 0 8.397 1.719 13.594 5.67 5.196 3.953 13.052 10.56 16.942 14.962 3.89 4.402 5.532 6.972 5.532 10.604 0 3.633 0 76.856-.06 85.34-.059 8.485-7.877 14.757-17.134 14.881-9.257.124-29.135.124-29.135.124s.466 6.275.466 15.15-8.106 15.811-17.317 16.056c-9.21.245-71.944-.49-80.884-.245-8.94.245-16.975-6.794-16.975-15.422s.274-93.175.274-101.566zm16.734 3.946l-1.152 92.853a3.96 3.96 0 0 0 3.958 4.012l73.913.22a3.865 3.865 0 0 0 3.91-3.978l-.218-8.892a1.988 1.988 0 0 0-2.046-1.953s-21.866.64-31.767.293c-9.902-.348-16.672-6.807-16.675-15.516-.003-8.709.003-69.142.003-69.142a1.989 1.989 0 0 0-2.007-1.993l-23.871.082a4.077 4.077 0 0 0-4.048 4.014zm106.508-35.258c-1.666-1.45-3.016-.84-3.016 1.372v17.255c0 1.106.894 2.007 1.997 2.013l20.868.101c2.204.011 2.641-1.156.976-2.606l-20.825-18.135zm-57.606.847a2.002 2.002 0 0 0-2.02 1.988l-.626 96.291a2.968 2.968 0 0 0 2.978 2.997l75.2-.186a2.054 2.054 0 0 0 2.044-2.012l1.268-62.421a1.951 1.951 0 0 0-1.96-2.004s-26.172.042-30.783.042c-4.611 0-7.535-2.222-7.535-6.482S152.3 63.92 152.3 63.92a2.033 2.033 0 0 0-2.015-2.018l-36.464-.23z"
fill-rule="evenodd" fill="currentColor"/>
</svg>
Copy Fediverse Address
</span>
</button>
<button type="button"
id="sub-new-success-btn-tg"
class="flex w-full justify-center text-center">
<span class="pt-1">&#10697; Follow In Telegram</span>
</button>
</div>
</div>
Expand Down
32 changes: 20 additions & 12 deletions web/sub-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function loadSubDetailsById(id) {
.writeText(addrFediverse)
.then(() => {
alert(`Copied the address to the clipboard:\n\n${addrFediverse}\n\nOpen your Fediverse client, paste to a search field and follow.`);
})
});
}
} else {
document.getElementById("follow-fediverse").style.display = "none";
Expand Down Expand Up @@ -601,17 +601,25 @@ function createSubscription() {
if (id) {
document.getElementById("sub-new-success-dialog").style.display = "block";
document.getElementById("new-sub-id").innerText = id;
if (userId) {
if (userId.startsWith("tg://user?id=")) {
document.getElementById("sub-new-success-btn-tg").style.display = "block";
document.getElementById("sub-new-success-btn-tg").onclick = () => {
window.open(`https://t.me/AwakariBot?start=${id}`, '_blank');
}
} else {
document.getElementById("sub-new-success-btn-feed").style.display = "block";
document.getElementById("sub-new-success-btn-feed").onclick = () => {
window.open(`https://reader.awakari.com/v1/sub/rss/${id}`, '_blank');
}
document.getElementById("sub-new-success-btn-tg").onclick = () => {
window.open(`https://t.me/AwakariBot?start=${id}`, '_blank');
}
if (isPublic || (userId && !userId.startsWith("tg://user?id="))) {
document.getElementById("sub-new-success-btn-feed").style.display = "block";
document.getElementById("sub-new-success-btn-feed").onclick = () => {
window.open(`https://reader.awakari.com/v1/sub/rss/${id}`, '_blank');
}
}
if (isPublic) {
document.getElementById("sub-new-success-btn-ap").style.display = "block";
document.getElementById("sub-new-success-btn-ap").onclick = () => {
const addrFediverse = `@${id}@activitypub.awakari.com`;
navigator
.clipboard
.writeText(addrFediverse)
.then(() => {
alert(`Copied the address to the clipboard:\n\n${addrFediverse}\n\nOpen your Fediverse client, paste to a search field and follow.`);
})
}
}
}
Expand Down

0 comments on commit 2f2b4c8

Please sign in to comment.