Skip to content

Commit

Permalink
fix: 修复 SurgeMac ShadowsocksR obfs-param
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Aug 28, 2024
1 parent 153802c commit 9abeb4c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store",
"version": "2.14.362",
"version": "2.14.364",
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
"main": "src/main.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/core/proxy-utils/parsers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function URI_SSR() {
for (const item of line) {
let [key, val] = item.split('=');
val = val.trim();
if (val.length > 0) {
if (val.length > 0 && val !== '(null)') {
other_params[key] = val;
}
}
Expand Down
11 changes: 7 additions & 4 deletions backend/src/core/proxy-utils/producers/surgemac.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Result } from './utils';
import { Result, isPresent } from './utils';
import Surge_Producer from './surge';
import { isIPv4, isIPv6, isPresent } from '@/utils';
import { isIPv4, isIPv6 } from '@/utils';
import $ from '@/core/app';

const targetPlatform = 'SurgeMac';
Expand Down Expand Up @@ -84,6 +84,7 @@ function shadowsocksr(proxy) {
for (const [key, value] of Object.entries({
cipher: '-m',
obfs: '-o',
'obfs-param': '-g',
password: '-k',
port: '-p',
protocol: '-O',
Expand All @@ -92,8 +93,10 @@ function shadowsocksr(proxy) {
'local-port': '-l',
'local-address': '-b',
})) {
external_proxy.args.push(value);
external_proxy.args.push(external_proxy[key]);
if (external_proxy[key] != null) {
external_proxy.args.push(value);
external_proxy.args.push(external_proxy[key]);
}
}

return external(external_proxy);
Expand Down

0 comments on commit 9abeb4c

Please sign in to comment.