mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-04-22 13:49:35 +08:00
feat: ProxyUtils.removeFlag
This commit is contained in:
parent
99d058bcf1
commit
b6f848a6e6
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sub-store",
|
||||
"version": "2.14.330",
|
||||
"version": "2.14.331",
|
||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||
"main": "src/main.js",
|
||||
"scripts": {
|
||||
|
@ -15,7 +15,7 @@ import $ from '@/core/app';
|
||||
import { FILES_KEY, MODULES_KEY } from '@/constants';
|
||||
import { findByName } from '@/utils/database';
|
||||
import { produceArtifact } from '@/restful/sync';
|
||||
import { getFlag, getISO, MMDB } from '@/utils/geo';
|
||||
import { getFlag, removeFlag, getISO, MMDB } from '@/utils/geo';
|
||||
import Gist from '@/utils/gist';
|
||||
|
||||
function preprocess(raw) {
|
||||
@ -276,6 +276,7 @@ export const ProxyUtils = {
|
||||
isIP,
|
||||
yaml: YAML,
|
||||
getFlag,
|
||||
removeFlag,
|
||||
getISO,
|
||||
MMDB,
|
||||
Gist,
|
||||
|
@ -2,7 +2,7 @@ import resourceCache from '@/utils/resource-cache';
|
||||
import scriptResourceCache from '@/utils/script-resource-cache';
|
||||
import { isIPv4, isIPv6 } from '@/utils';
|
||||
import { FULL } from '@/utils/logical';
|
||||
import { getFlag } from '@/utils/geo';
|
||||
import { getFlag, removeFlag } from '@/utils/geo';
|
||||
import lodash from 'lodash';
|
||||
import $ from '@/core/app';
|
||||
import { hex_md5 } from '@/vendor/md5';
|
||||
@ -869,13 +869,6 @@ function clone(object) {
|
||||
return JSON.parse(JSON.stringify(object));
|
||||
}
|
||||
|
||||
// remove flag
|
||||
function removeFlag(str) {
|
||||
return str
|
||||
.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴☠️|🏳️🌈/g, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
function createDynamicFunction(name, script, $arguments) {
|
||||
const flowUtils = {
|
||||
getFlowField,
|
||||
|
@ -430,6 +430,13 @@ export function getISO(name) {
|
||||
return ISOFlags[getFlag(name)]?.[0];
|
||||
}
|
||||
|
||||
// remove flag
|
||||
export function removeFlag(str) {
|
||||
return str
|
||||
.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]|🏴☠️|🏳️🌈/g, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
export class MMDB {
|
||||
constructor({ country, asn } = {}) {
|
||||
if ($.env.isNode) {
|
||||
|
@ -40,12 +40,15 @@ function operator(proxies = [], targetPlatform, context) {
|
||||
// isIP,
|
||||
// yaml, // yaml 解析和生成
|
||||
// getFlag, // 获取 emoji 旗帜
|
||||
// removeFlag, // 移除 emoji 旗帜
|
||||
// getISO, // 获取 ISO 3166-1 alpha-2 代码
|
||||
// Gist, // Gist 类
|
||||
// }
|
||||
|
||||
// 示例: 给节点名添加前缀
|
||||
// $server.name = `[${ProxyUtils.getISO($server.name)}] ${$server.name}`
|
||||
// 示例: 给节点名添加旗帜
|
||||
// $server.name = `[${ProxyUtils.getFlag($server.name).replace(/🇹🇼/g, '🇼🇸')}] ${ProxyUtils.removeFlag($server.name)}`
|
||||
|
||||
// 示例: 从 sni 文件中读取内容并进行节点操作
|
||||
// const sni = await produceArtifact({
|
||||
|
Loading…
x
Reference in New Issue
Block a user