Skip to content

Commit a016401

Browse files
committed
[open-in-app] fix spotify and soundcloud urls
1 parent 6092dba commit a016401

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

plugins/open-in-app/index.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ const {
55
export const apps = {
66
Spotify: {
77
hostnames: ["open.spotify.com", "spotify.link"],
8-
protocol: "spotify://",
8+
protocolName: "spotify",
9+
applyProtocol: (url) => `spotify:/${url.pathname}`,
910
default: true
1011
},
1112
Steam: {
@@ -14,12 +15,14 @@ export const apps = {
1415
"steamcommunity.com",
1516
"help.steampowered.com"
1617
],
17-
protocol: "steam://openurl/",
18+
protocolName: "steam",
19+
applyProtocol: (url) => `steam://openurl/${url}`,
1820
default: true
1921
},
2022
SoundCloud: {
2123
hostnames: ["soundcloud.com", "on.soundcloud.com"],
22-
protocol: "soundpout://",
24+
protocolName: "soundpout",
25+
applyProtocol: (url) => `soundpout:/${url.pathname}`,
2326
default: false
2427
}
2528
};
@@ -54,7 +57,7 @@ async function openInApp(url) {
5457
}
5558

5659
const [appName, app] = getEnabledApp(url);
57-
const replacedUrl = app.protocol + url;
60+
const replacedUrl = app.applyProtocol(url);
5861

5962
window.open(replacedUrl, "_blank")?.close();
6063
} catch (e) {

plugins/open-in-app/settings.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const settings = () => {
1414
onChange={(value) => {
1515
store[appName] = value;
1616
}}
17-
note={app.protocol}
17+
note={"Opens with this protocol: " + app.protocolName + "://"}
1818
>
1919
{appName}
2020
</SwitchItem>

0 commit comments

Comments
 (0)