Skip to content

Commit

Permalink
1.3.0 => 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ManeraKai committed Jul 18, 2023
1 parent 3fda97f commit 1dea11f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_extensionName__",
"description": "__MSG_extensionDescription__",
"version": "1.3.0",
"version": "1.4.0",
"manifest_version": 2,
"browser_specific_settings": {
"gecko": {
Expand Down
12 changes: 8 additions & 4 deletions src/pages/lib/lemmy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function isLemmy(url) {
if (req.status == 200) {
try {
const data = JSON.parse(req.responseText)
if (data.serverVersion) {
if (data.version) {
resolve(true)
return
}
Expand Down Expand Up @@ -77,9 +77,13 @@ function redirect_post(post, options) {
const req = new XMLHttpRequest();
req.open("GET", `${utils.protocolHost(options.lemmy.instance)}/api/v3/resolve_object?q=${encodeURIComponent(post)}&auth=${encodeURIComponent(options.lemmy.auth)}`, false)
req.onload = () => {
const id = JSON.parse(req.responseText)['post']['post']['id']
resolve(`${utils.protocolHost(options.lemmy.instance)}/post/${id}`)
return
if (req.status == 200) {
const data = JSON.parse(req.responseText)
const id = data['post']['post']['id']
resolve(`${utils.protocolHost(options.lemmy.instance)}/post/${id}`)
return
}
resolve()
}
req.send();
})
Expand Down
5 changes: 0 additions & 5 deletions src/pages/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,30 @@ let options
}
}
if (await lemmy.isLemmy(url)) {
console.log('lemmy')
custom_switch(redirector.can_lemmy_to_lemmy, redirector.lemmy_to_lemmy, 'redirect_to_lemmy')
custom_switch(redirector.can_lemmy_to_mastodon, redirector.lemmy_to_mastodon, 'redirect_to_mastodon')
custom_switch(redirector.can_lemmy_to_soapbox, redirector.lemmy_to_soapbox, 'redirect_to_soapbox')
custom_switch(redirector.can_lemmy_to_calckey, redirector.lemmy_to_calckey, 'redirect_to_calckey')
}
if (await mastodon.isMastodon(url)) {
console.log('mastodon')
custom_switch(redirector.can_mastodon_to_lemmy, redirector.mastodon_to_lemmy, 'redirect_to_lemmy')
custom_switch(redirector.can_mastodon_to_mastodon, redirector.mastodon_to_mastodon, 'redirect_to_mastodon')
custom_switch(redirector.can_mastodon_to_soapbox, redirector.mastodon_to_soapbox, 'redirect_to_soapbox')
custom_switch(redirector.can_mastodon_to_calckey, redirector.mastodon_to_calckey, 'redirect_to_calckey')
}
if (await soapbox.isSoapbox(url)) {
console.log('soapbox')
custom_switch(redirector.can_soapbox_to_lemmy, redirector.soapbox_to_lemmy, 'redirect_to_lemmy')
custom_switch(redirector.can_soapbox_to_mastodon, redirector.soapbox_to_mastodon, 'redirect_to_mastodon')
custom_switch(redirector.can_soapbox_to_soapbox, redirector.soapbox_to_soapbox, 'redirect_to_soapbox')
custom_switch(redirector.can_soapbox_to_calckey, redirector.soapbox_to_calckey, 'redirect_to_calckey')
}
if (await calckey.isCalckey(url)) {
console.log('calckey')
custom_switch(redirector.can_calckey_to_mastodon, redirector.calckey_to_mastodon, 'redirect_to_mastodon')
custom_switch(redirector.can_calckey_to_soapbox, redirector.calckey_to_soapbox, 'redirect_to_soapbox')
custom_switch(redirector.can_calckey_to_lemmy, redirector.calckey_to_lemmy, 'redirect_to_lemmy')
custom_switch(redirector.can_calckey_to_calckey, redirector.calckey_to_calckey, 'redirect_to_calckey')
}
if (await peertube.isPeertube(url)) {
console.log('peertube')
custom_switch(redirector.can_peertube_to_peertube, redirector.peertube_to_peertube, 'redirect_to_peertube')
custom_switch(redirector.can_peertube_to_mastodon, redirector.peertube_to_mastodon, 'redirect_to_mastodon')
custom_switch(redirector.can_peertube_to_soapbox, redirector.peertube_to_soapbox, 'redirect_to_soapbox')
Expand Down
20 changes: 20 additions & 0 deletions src/pages/popup/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,24 @@ div.block {

div.block h4 {
min-width: 200px;
}

.loader {
border: 3px solid #00000000;
border-top: 3px solid #fbc117;
border-radius: 50%;
box-sizing: border-box;
width: 25px;
height: 25px;
animation: spin 1s ease infinite;
}

@keyframes spin {
0% {
transform: rotate(0deg);
}

100% {
transform: rotate(360deg);
}
}

0 comments on commit 1dea11f

Please sign in to comment.