fix TypeError: this.shortIds.split is not a function (#2507)

* fix TypeError: this.shortIds.split is not a function
This commit is contained in:
Dmitry Zhavoronkov 2024-09-02 17:02:15 +07:00 committed by GitHub
parent 2dc59a601c
commit 4494ffabb6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 160 additions and 160 deletions

View file

@ -268,13 +268,13 @@ func (s *SubJsonService) realityData(rData map[string]interface{}) map[string]in
rltyData["spiderX"] = "/" + random.Seq(15) rltyData["spiderX"] = "/" + random.Seq(15)
shortIds, ok := rData["shortIds"].([]interface{}) shortIds, ok := rData["shortIds"].([]interface{})
if ok && len(shortIds) > 0 { if ok && len(shortIds) > 0 {
rltyData["shortId"] = shortIds[random.Num(len(shortIds))].(string) rltyData["shortId"] = shortIds
} else { } else {
rltyData["shortId"] = "" rltyData["shortId"] = ""
} }
serverNames, ok := rData["serverNames"].([]interface{}) serverNames, ok := rData["serverNames"].([]interface{})
if ok && len(serverNames) > 0 { if ok && len(serverNames) > 0 {
rltyData["serverName"] = serverNames[random.Num(len(serverNames))].(string) rltyData["serverName"] = serverNames
} else { } else {
rltyData["serverName"] = "" rltyData["serverName"] = ""
} }

View file

@ -914,7 +914,7 @@ class RealityStreamSettings extends XrayCommonClass {
minClient = '', minClient = '',
maxClient = '', maxClient = '',
maxTimediff = 0, maxTimediff = 0,
shortIds = RandomUtil.randomShortId(), shortIds = RandomUtil.randomShortIds(),
settings = new RealityStreamSettings.Settings() settings = new RealityStreamSettings.Settings()
) { ) {
super(); super();

View file

@ -99,7 +99,7 @@ class RandomUtil {
return str; return str;
} }
static randomShortId() { static randomShortIds() {
const lengths = [2, 4, 6, 8, 10, 12, 14, 16]; const lengths = [2, 4, 6, 8, 10, 12, 14, 16];
for (let i = lengths.length - 1; i > 0; i--) { for (let i = lengths.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1)); const j = Math.floor(Math.random() * (i + 1));
@ -114,7 +114,7 @@ class RandomUtil {
} }
shortIds.push(shortId); shortIds.push(shortId);
} }
return shortIds; return shortIds.join(',');
} }
static randomLowerAndNum(len) { static randomLowerAndNum(len) {

View file

@ -189,7 +189,7 @@
<a-tooltip> <a-tooltip>
<template slot="title"> <template slot="title">
<span>{{ i18n "reset" }}</span> <span>{{ i18n "reset" }}</span>
</template> Short ID <a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortId()" type="sync"></a-icon> </template> Short IDs <a-icon @click="inbound.stream.reality.shortIds = RandomUtil.randomShortIds()" type="sync"></a-icon>
</a-tooltip> </a-tooltip>
</template> </template>
<a-input v-model.trim="inbound.stream.reality.shortIds"></a-input> <a-input v-model.trim="inbound.stream.reality.shortIds"></a-input>