Subscriptions: offer MASQUE clients only the JSON subscription

This commit is contained in:
Alireza Ahmadi 2026-10-10 23:00:52 +02:00
parent ccb92c70bf
commit b5fbb94cfc
4 changed files with 16 additions and 4 deletions

View file

@ -60,6 +60,10 @@ class DBInbound {
return this.protocol === Protocols.WIREGUARD;
}
get isMasque() {
return this.protocol === Protocols.MASQUE;
}
get address() {
let address = location.hostname;
if (!ObjectUtil.isEmpty(this.listen) && this.listen !== "0.0.0.0") {

View file

@ -34,7 +34,8 @@
width="560px" :class="themeSwitcher.currentTheme">
<a-collapse v-model="qrModal.activeKey">
<template v-if="app.subSettings.enable && qrModal.subId">
<a-collapse-panel key="sub" :force-render="true">
<!-- MASQUE has no share link format, so only the JSON subscription carries it -->
<a-collapse-panel v-if="qrModal.dbInbound.protocol !== Protocols.MASQUE" key="sub" :force-render="true">
<span slot="header">{{ i18n "pages.settings.subSettings" }}</span>
<div class="qr-panel-actions">
<a-button size="small" icon="copy" @click.stop="copyToClipboard(genSubLink(qrModal.subId))"></a-button>

View file

@ -206,7 +206,8 @@
</table>
<template v-if="app.subSettings.enable && infoModal.clientSettings.subId && !dbInbound.isWireguard">
<a-divider>Subscription URL</a-divider>
<a-row>
<!-- MASQUE has no share link format, so only the JSON subscription carries it -->
<a-row v-if="!dbInbound.isMasque">
<a-col :sx="24" :md="22">SUB: <a :href="[[ infoModal.subLink ]]" target="_blank">[[ infoModal.subLink ]]</a></a-col>
<a-col :sx="24" :md="2" style="text-align: right;">
<a-tooltip title='{{ i18n "copy" }}'>

View file

@ -1291,6 +1291,12 @@
newDbInbound = this.checkFallback(dbInbound);
txtModal.show('{{ i18n "pages.inbounds.export"}}', newDbInbound.genInboundLinks(this.remarkModel), newDbInbound.remark);
},
// MASQUE has no share link format, so its clients only work through
// the JSON subscription; the plain one answers them with an error.
subLinkFor(dbInbound, subId) {
if (dbInbound.protocol === Protocols.MASQUE) return this.subSettings.subJsonURI + subId;
return this.subSettings.subURI + subId + "?name=" + subId;
},
exportSubs(dbInboundId) {
const dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
const clients = this.getInboundClients(dbInbound);
@ -1298,7 +1304,7 @@
if (clients != null){
clients.forEach(c => {
if (c.subId && c.subId.length>0){
subLinks.push(this.subSettings.subURI + c.subId + "?name=" + c.subId)
subLinks.push(this.subLinkFor(dbInbound, c.subId))
}
})
}
@ -1325,7 +1331,7 @@
if (clients != null){
clients.forEach(c => {
if (c.subId && c.subId.length>0){
subLinks.push(this.subSettings.subURI + c.subId + "?name=" + c.subId)
subLinks.push(this.subLinkFor(dbInbound, c.subId))
}
})
}