Currently, a lot of people, when linking to this webring from their own sites are adhering to this pattern:
https://somewebsite.com#somewebsite.com
Right now, for all sites that link to here using such patterns, the inbound handling will, instead of highlighting only the website specified after the hash value, also call the next() function and highlights the one after instead.
Examples using random websites from webring:
https://webring.wonderful.software#warat.win
https://webring.wonderful.software#llun.me
https://webring.wonderful.software#suam.wtf
Pick any from the example above and you will see that webring calls the next() function after half a second (you can also see that the next button is clicked), which is exactly what is written in your code ( index.js line 164 )
if (inbound) {
setTimeout(() => {
next()
autoNext.value = true
}, 500)
}
However, these (with slashes) are fine:
https://webring.wonderful.software/#/warat.win
https://webring.wonderful.software/#/llun.me
https://webring.wonderful.software/#/suam.wtf
The current implementation of hash handling inserts a slash in between the hash and its value. In such cases, matchLink would always be true, because the id provided is correct, it's just that the pattern is different. Within the same loop, you return true ( index.js line 104)
if (hash.startsWith("#") && !hash.startsWith("#/")) {
const id = (
(hash.match(/[a-z0-9\.-]+/i) || [])[0] || ""
).toLowerCase()
location.replace("#/" + id)
const matchedLink = links.find((l) => l.id === id)
if (matchedLink) {
sendBeacon("inbound", matchedLink.id)
transitionInfo.needsInboundTransition = true
inboundReferrer = matchedLink.id
return true
}
}
}
"true" would later be used in the if (inbound) line ( index.js line 157 )
Vue.onMounted(() => {
const inbound = processInboundLink()
updateCurrentLink()
if (!currentLink.value && location.hash !== "#/list") {
autoRandom.value = true
random()
}
if (inbound) {
setTimeout(() => {
next()
autoNext.value = true
}, 500)
}
// ...
So, the question is:
Do you really need to check for
in the if condition in line 104? By removing it, the problem is solved immediately.
I believe this issue should be corrected asap as the pattern above is what is shown in the docs and as mentioned at the beginning, a lot of people are already using this pattern.
//From docs here: https://github.com/wonderfulsoftware/webring
<a href="https://webring.wonderful.software#YOUR.DOMAIN" title="วงแหวนเว็บ">
<img
alt="วงแหวนเว็บ"
width="32"
height="32"
src="https://webring.wonderful.software/webring.black.svg"
/>
</a>
I'm not making a pull request because I'm not sure whether this is intentional or not. The docs could just be wrong, and in that case, a simple edit, telling the people to prepend and append the hash with slashes would suffice.
<a href="https://webring.wonderful.software/#/YOUR.DOMAIN" title="วงแหวนเว็บ">
//...
</a>