@tianacloud/dsh-remote 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -438,11 +438,28 @@
438
438
  sessionsEmpty: '当前没有活跃的远端浏览器会话',
439
439
  disconnect: '断开',
440
440
  disconnectAll: '断开全部',
441
- settingsTitle: '主机、换绑与网络插件策略',
441
+ settingsTitle: '主机、换绑与网络设置',
442
442
  hostName: '主机显示名',
443
443
  p2pToggle: '启用 WebRTC P2P 直连优先',
444
444
  stunUrls: 'STUN 服务器(逗号分隔)',
445
- allowedPlugins: '远端放行的第三方 Web 插件(未勾选时仅放行内置核心与 Tiana Remote)',
445
+ allowedPlugins: '远端放行的第三方 Web 插件',
446
+ pluginPolicyTitle: '远端插件访问策略',
447
+ pluginModeAllowAll: '默认放行所有(黑名单模式)',
448
+ pluginModeDenyAll: '默认不放行(白名单模式)',
449
+ pluginBlacklistHint: '默认放行所有第三方插件;勾选下方插件加入黑名单即可在远端屏蔽。',
450
+ pluginWhitelistHint: '默认屏蔽所有第三方插件;仅勾选下方插件加入白名单才会在远端放行。',
451
+ pluginCoreNote: '内置核心模块(@deepseek-ai/dsh-*)与 @tianacloud/dsh-remote 始终放行,不受黑白名单限制。',
452
+ pluginEnvOverrideNote: '当前主机设置了 DSH_REMOTE_WEB_PLUGINS 环境变量,将优先于下方保存的策略生效。',
453
+ pluginEmpty: '当前未检测到已安装的第三方 Web 插件',
454
+ pluginStateAllowed: '放行',
455
+ pluginStateBlocked: '已屏蔽',
456
+ savePluginPolicy: '保存插件策略',
457
+ pluginPolicySavedLocal: '插件策略已保存,远端页面刷新后生效。',
458
+ pluginPolicySavedRemote: '插件策略已保存。刷新远程工作台即可加载最新插件列表。',
459
+ reloadWorkbenchBtn: '立即刷新远程工作台',
460
+ conflictBannerTitle: '检测到重复的 DSH 主机进程冲突',
461
+ conflictBannerOwnedByOther: '另一台本地 DSH 进程正在占用 Relay 连接,本进程已暂停重复建连以避免断线循环。请关闭多余的 DSH 实例。',
462
+ conflictBannerRelayKicked: '当前 Relay 连接被同 host_id 的另一个主机实例顶替,已启用退避重连。请检查并停止本机多余的 DSH 进程。',
446
463
  saveSettings: '保存设置',
447
464
  resetDraft: '放弃未保存更改',
448
465
  saving: '保存中…',
@@ -459,7 +476,7 @@
459
476
  remoteRelay: 'Tiana Relay 加密中继',
460
477
  remoteReconnecting: '正在重连…',
461
478
  remoteRtt: '往返延迟 (RTT)',
462
- remoteSecurityNote: '安全边界说明:当前处于远端隧道受限视图。配对密钥查看/轮换与主机管理接口仅限本机回环访问,远端隧道严格返回 403 拦截。',
479
+ remoteSecurityNote: '安全边界说明:当前处于远端隧道受限视图。配对密钥查看/轮换与主机管理接口仅限本机访问,远端隧道严格返回 403 拦截;你可在下方管理远端插件黑白名单。',
463
480
  clearCacheBtn: '刷新前端模块缓存',
464
481
  lockForgetBtn: '锁定并清除此设备密钥',
465
482
  onboardTitle: '绑定或新建云端 DSH Remote 应用',
@@ -516,11 +533,28 @@
516
533
  sessionsEmpty: 'No active remote sessions',
517
534
  disconnect: 'Disconnect',
518
535
  disconnectAll: 'Disconnect All',
519
- settingsTitle: 'Host, Rebind & Network Policy',
536
+ settingsTitle: 'Host, Rebind & Network Settings',
520
537
  hostName: 'Host Display Name',
521
538
  p2pToggle: 'Prefer WebRTC P2P Direct Connection',
522
539
  stunUrls: 'STUN Servers (comma-separated)',
523
- allowedPlugins: 'Allowed Third-Party Web Plugins (unchecked = core + Tiana Remote only)',
540
+ allowedPlugins: 'Remote Third-Party Web Plugins',
541
+ pluginPolicyTitle: 'Remote Plugin Access Policy',
542
+ pluginModeAllowAll: 'Allow All by Default (Blacklist)',
543
+ pluginModeDenyAll: 'Deny All by Default (Whitelist)',
544
+ pluginBlacklistHint: 'All third-party plugins are allowed by default; check plugins below to block them remotely.',
545
+ pluginWhitelistHint: 'All third-party plugins are blocked by default; check plugins below to allow them remotely.',
546
+ pluginCoreNote: 'Built-in core modules (@deepseek-ai/dsh-*) and @tianacloud/dsh-remote are always allowed.',
547
+ pluginEnvOverrideNote: 'DSH_REMOTE_WEB_PLUGINS environment variable is currently overriding saved policy on this host.',
548
+ pluginEmpty: 'No installed third-party Web plugins detected',
549
+ pluginStateAllowed: 'Allowed',
550
+ pluginStateBlocked: 'Blocked',
551
+ savePluginPolicy: 'Save Plugin Policy',
552
+ pluginPolicySavedLocal: 'Plugin policy saved. Refresh open remote tabs to apply.',
553
+ pluginPolicySavedRemote: 'Plugin policy saved. Reload the remote workbench to apply changes.',
554
+ reloadWorkbenchBtn: 'Reload Remote Workbench',
555
+ conflictBannerTitle: 'Duplicate DSH Host Process Conflict Detected',
556
+ conflictBannerOwnedByOther: 'Another live DSH process currently owns the Relay bridge. This instance paused duplicate connection attempts to prevent reconnect loops. Stop extra DSH processes.',
557
+ conflictBannerRelayKicked: 'The Relay connection was replaced by another host using the same host_id. Backoff is active; stop duplicate DSH instances to stabilize.',
524
558
  saveSettings: 'Save Settings',
525
559
  resetDraft: 'Discard Unsaved Edits',
526
560
  saving: 'Saving…',
@@ -537,7 +571,7 @@
537
571
  remoteRelay: 'Tiana Encrypted Relay',
538
572
  remoteReconnecting: 'Reconnecting…',
539
573
  remoteRtt: 'Round-Trip Latency (RTT)',
540
- remoteSecurityNote: 'Security Isolation: You are viewing the restricted remote session panel. Pairing keys and host admin APIs are strictly blocked (403) over the remote tunnel.',
574
+ remoteSecurityNote: 'Security Isolation: Pairing keys and host admin APIs are strictly blocked (403) over the remote tunnel. You can still configure remote plugin blacklist/whitelist policy below.',
541
575
  clearCacheBtn: 'Refresh Frontend Module Cache',
542
576
  lockForgetBtn: 'Lock & Forget Key on This Device',
543
577
  onboardTitle: 'Bind or Create a Tiana DSH Remote App',
@@ -596,6 +630,28 @@
596
630
  background: var(--dsw-alias-bg-layer-3, rgba(15, 23, 42, 0.6));
597
631
  border: 1px solid var(--dsw-alias-border-l1, rgba(148, 163, 184, 0.25));
598
632
  }
633
+ .dshr-plugin-pill {
634
+ display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border-radius: 10px;
635
+ font-size: 12px; font-weight: 500; cursor: pointer;
636
+ background: var(--dsw-alias-bg-layer-1, rgba(15, 23, 42, 0.5));
637
+ border: 1px solid var(--dsw-alias-border-l1, rgba(148, 163, 184, 0.25));
638
+ }
639
+ .dshr-plugin-pill.is-blocked {
640
+ border-color: rgba(248, 113, 113, 0.45);
641
+ background: rgba(220, 38, 38, 0.1);
642
+ }
643
+ .dshr-plugin-pill.is-allowed {
644
+ border-color: rgba(34, 197, 94, 0.38);
645
+ }
646
+ .dshr-state-tag {
647
+ font-size: 11px; padding: 1px 6px; border-radius: 999px;
648
+ }
649
+ .dshr-state-tag.is-allowed {
650
+ background: rgba(34, 197, 94, 0.18); color: #4ade80;
651
+ }
652
+ .dshr-state-tag.is-blocked {
653
+ background: rgba(239, 68, 68, 0.18); color: #f87171;
654
+ }
599
655
  .dshr-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
600
656
  .dshr-dot.is-online { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
601
657
  .dshr-dot.is-warn { background: #f59e0b; }
@@ -656,6 +712,10 @@
656
712
  padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
657
713
  background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(96, 165, 250, 0.35);
658
714
  }
715
+ .dshr-warn {
716
+ padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5;
717
+ background: rgba(245, 158, 11, 0.14); border: 1px solid rgba(251, 191, 36, 0.45);
718
+ }
659
719
  .dshr-err {
660
720
  padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.45;
661
721
  background: rgba(220, 38, 38, 0.14);
@@ -779,10 +839,19 @@
779
839
  const [hostNameDraft, setHostNameDraft] = useState('');
780
840
  const [p2pDraft, setP2pDraft] = useState(true);
781
841
  const [stunDraft, setStunDraft] = useState('');
782
- const [pluginsDraft, setPluginsDraft] = useState([]);
783
842
  const settingsDirtyRef = useRef(false);
784
843
  const [settingsDirty, setSettingsDirty] = useState(false);
785
844
 
845
+ // Plugin access policy state (shared by both Local and Remote views)
846
+ const [pluginAccess, setPluginAccess] = useState(null);
847
+ const [pluginModeDraft, setPluginModeDraft] = useState('allow_all');
848
+ const [blockedPluginsDraft, setBlockedPluginsDraft] = useState([]);
849
+ const [allowedPluginsDraft, setAllowedPluginsDraft] = useState([]);
850
+ const pluginDirtyRef = useRef(false);
851
+ const [pluginDirty, setPluginDirty] = useState(false);
852
+ const [pluginReloadNeeded, setPluginReloadNeeded] = useState(false);
853
+ const [pluginError, setPluginError] = useState('');
854
+
786
855
  // Provision / Onboarding / Rebind state
787
856
  const [onboardTab, setOnboardTab] = useState('bind');
788
857
  const [bindWebId, setBindWebId] = useState('');
@@ -800,7 +869,13 @@
800
869
  setHostNameDraft(data.host?.hostName || '');
801
870
  setP2pDraft(data.network?.p2pEnabled !== false);
802
871
  setStunDraft((data.network?.stunUrls || []).join(','));
803
- setPluginsDraft(Array.isArray(data.allowedWebPlugins) ? data.allowedWebPlugins : []);
872
+ }, []);
873
+
874
+ const hydratePluginDrafts = useCallback((pa) => {
875
+ if (!pa || typeof pa !== 'object') return;
876
+ setPluginModeDraft(pa.mode === 'deny_all' ? 'deny_all' : 'allow_all');
877
+ setBlockedPluginsDraft(Array.isArray(pa.blockedWebPlugins) ? pa.blockedWebPlugins : []);
878
+ setAllowedPluginsDraft(Array.isArray(pa.allowedWebPlugins) ? pa.allowedWebPlugins : []);
804
879
  }, []);
805
880
 
806
881
  const markDirty = () => {
@@ -808,11 +883,29 @@
808
883
  setSettingsDirty(true);
809
884
  };
810
885
 
886
+ const markPluginDirty = () => {
887
+ pluginDirtyRef.current = true;
888
+ setPluginDirty(true);
889
+ setPluginError('');
890
+ };
891
+
811
892
  const fetchState = useCallback(async () => {
812
893
  try {
813
894
  if (isRemote) {
814
- const resp = await fetch('/api/tiana-remote/public-status', { cache: 'no-store' });
815
- if (resp.ok) setPublicStatus(await resp.json());
895
+ const [statusRes, policyRes] = await Promise.allSettled([
896
+ fetch('/api/tiana-remote/public-status', { cache: 'no-store' }),
897
+ fetch('/api/tiana-remote/plugin-access', { cache: 'no-store' }),
898
+ ]);
899
+ if (statusRes.status === 'fulfilled' && statusRes.value.ok) {
900
+ setPublicStatus(await statusRes.value.json());
901
+ }
902
+ if (policyRes.status === 'fulfilled' && policyRes.value.ok) {
903
+ const pa = await policyRes.value.json();
904
+ setPluginAccess(pa);
905
+ if (!pluginDirtyRef.current) {
906
+ hydratePluginDrafts(pa);
907
+ }
908
+ }
816
909
  const snap = globalThis.__DSH_REMOTE_SHELL__?.getStatusSnapshot?.();
817
910
  if (snap) setShellSnap(snap);
818
911
  } else {
@@ -825,6 +918,19 @@
825
918
  if (!settingsDirtyRef.current) {
826
919
  hydrateDraftsFromOverview(data);
827
920
  }
921
+ const pa = data.pluginAccess || {
922
+ mode: data.security?.pluginAccessMode === 'deny_all' ? 'deny_all' : 'allow_all',
923
+ blockedWebPlugins: Array.isArray(data.security?.blockedWebPlugins) ? data.security.blockedWebPlugins : [],
924
+ allowedWebPlugins: Array.isArray(data.security?.allowedWebPlugins)
925
+ ? data.security.allowedWebPlugins
926
+ : (Array.isArray(data.allowedWebPlugins) ? data.allowedWebPlugins : []),
927
+ installedWebPlugins: Array.isArray(data.installedWebPlugins) ? data.installedWebPlugins : [],
928
+ envOverride: Boolean(data.envOverrides?.allowedWebPlugins),
929
+ };
930
+ setPluginAccess(pa);
931
+ if (!pluginDirtyRef.current) {
932
+ hydratePluginDrafts(pa);
933
+ }
828
934
  } else {
829
935
  let errMessage = '';
830
936
  try {
@@ -857,7 +963,7 @@
857
963
  setAdminLoading(false);
858
964
  }
859
965
  }
860
- }, [isRemote, hydrateDraftsFromOverview]);
966
+ }, [isRemote, hydrateDraftsFromOverview, hydratePluginDrafts]);
861
967
 
862
968
  const pollProvisionStatus = useCallback(async () => {
863
969
  if (isRemote) return;
@@ -904,6 +1010,171 @@
904
1010
  }
905
1011
  };
906
1012
 
1013
+ const handleSavePluginPolicy = async (ev) => {
1014
+ ev?.preventDefault?.();
1015
+ setBusy('plugin-policy');
1016
+ setPluginError('');
1017
+ try {
1018
+ const resp = await fetch('/api/tiana-remote/plugin-access', {
1019
+ method: 'POST',
1020
+ headers: { 'content-type': 'application/json' },
1021
+ body: JSON.stringify({
1022
+ mode: pluginModeDraft,
1023
+ blockedWebPlugins: blockedPluginsDraft,
1024
+ allowedWebPlugins: allowedPluginsDraft,
1025
+ }),
1026
+ });
1027
+ const data = await resp.json().catch(() => ({}));
1028
+ if (!resp.ok) {
1029
+ setPluginError(data.error || `HTTP ${resp.status}`);
1030
+ return;
1031
+ }
1032
+ pluginDirtyRef.current = false;
1033
+ setPluginDirty(false);
1034
+ setPluginAccess(data);
1035
+ hydratePluginDrafts(data);
1036
+ if (isRemote) {
1037
+ setPluginReloadNeeded(true);
1038
+ setToast(t('pluginPolicySavedRemote'));
1039
+ } else {
1040
+ setToast(t('pluginPolicySavedLocal'));
1041
+ await fetchState();
1042
+ }
1043
+ } catch (err) {
1044
+ setPluginError(err instanceof Error ? err.message : String(err || 'Network error'));
1045
+ } finally {
1046
+ setBusy('');
1047
+ }
1048
+ };
1049
+
1050
+ const handleDiscardPluginDrafts = () => {
1051
+ pluginDirtyRef.current = false;
1052
+ setPluginDirty(false);
1053
+ setPluginError('');
1054
+ if (pluginAccess) {
1055
+ hydratePluginDrafts(pluginAccess);
1056
+ }
1057
+ };
1058
+
1059
+ const renderPluginAccessCard = () => {
1060
+ const installedList = Array.isArray(pluginAccess?.installedWebPlugins)
1061
+ ? pluginAccess.installedWebPlugins
1062
+ : [];
1063
+ const allPlugins = [...new Set([
1064
+ ...installedList,
1065
+ ...blockedPluginsDraft,
1066
+ ...allowedPluginsDraft,
1067
+ ])];
1068
+ const isAllowAllMode = pluginModeDraft !== 'deny_all';
1069
+
1070
+ return h('div', { className: 'dshr-card', id: 'dshr-plugin-access-card' },
1071
+ h('form', { style: { display: 'grid', gap: 14 }, onSubmit: handleSavePluginPolicy },
1072
+ h('div', { className: 'dshr-card-head' },
1073
+ h('h3', { className: 'dshr-card-title' }, t('pluginPolicyTitle')),
1074
+ h('span', { className: 'dshr-badge', id: 'dshr-plugin-mode-badge' },
1075
+ isAllowAllMode ? t('pluginModeAllowAll') : t('pluginModeDenyAll'),
1076
+ ),
1077
+ ),
1078
+ h('div', { className: 'dshr-tabs', role: 'tablist' },
1079
+ h('button', {
1080
+ type: 'button',
1081
+ role: 'tab',
1082
+ className: 'dshr-tab',
1083
+ id: 'dshr-plugin-mode-allow-all',
1084
+ 'aria-selected': isAllowAllMode ? 'true' : 'false',
1085
+ onClick: () => {
1086
+ if (!isAllowAllMode) {
1087
+ markPluginDirty();
1088
+ setPluginModeDraft('allow_all');
1089
+ }
1090
+ },
1091
+ }, t('pluginModeAllowAll')),
1092
+ h('button', {
1093
+ type: 'button',
1094
+ role: 'tab',
1095
+ className: 'dshr-tab',
1096
+ id: 'dshr-plugin-mode-deny-all',
1097
+ 'aria-selected': !isAllowAllMode ? 'true' : 'false',
1098
+ onClick: () => {
1099
+ if (isAllowAllMode) {
1100
+ markPluginDirty();
1101
+ setPluginModeDraft('deny_all');
1102
+ }
1103
+ },
1104
+ }, t('pluginModeDenyAll')),
1105
+ ),
1106
+ h('div', { className: 'dshr-label', id: 'dshr-plugin-policy-hint' },
1107
+ isAllowAllMode ? t('pluginBlacklistHint') : t('pluginWhitelistHint'),
1108
+ ),
1109
+ pluginAccess?.envOverride && h('div', { className: 'dshr-warn' }, t('pluginEnvOverrideNote')),
1110
+ pluginError && h('div', { className: 'dshr-err', role: 'alert' }, pluginError),
1111
+ allPlugins.length === 0
1112
+ ? h('div', { className: 'dshr-label' }, t('pluginEmpty'))
1113
+ : h('div', { className: 'dshr-row', id: 'dshr-plugin-list' },
1114
+ allPlugins.map((pkg) => {
1115
+ const checked = isAllowAllMode
1116
+ ? blockedPluginsDraft.includes(pkg)
1117
+ : allowedPluginsDraft.includes(pkg);
1118
+ const isAllowed = isAllowAllMode ? !checked : checked;
1119
+ return h('label', {
1120
+ key: pkg,
1121
+ className: `dshr-plugin-pill ${isAllowed ? 'is-allowed' : 'is-blocked'}`,
1122
+ },
1123
+ h('input', {
1124
+ type: 'checkbox',
1125
+ 'data-plugin-pkg': pkg,
1126
+ checked,
1127
+ onChange: (e) => {
1128
+ markPluginDirty();
1129
+ const nextChecked = e.target.checked;
1130
+ if (isAllowAllMode) {
1131
+ setBlockedPluginsDraft((prev) => nextChecked
1132
+ ? [...new Set([...prev, pkg])]
1133
+ : prev.filter((item) => item !== pkg));
1134
+ } else {
1135
+ setAllowedPluginsDraft((prev) => nextChecked
1136
+ ? [...new Set([...prev, pkg])]
1137
+ : prev.filter((item) => item !== pkg));
1138
+ }
1139
+ },
1140
+ }),
1141
+ h('span', null, pkg),
1142
+ h('span', { className: `dshr-state-tag ${isAllowed ? 'is-allowed' : 'is-blocked'}` },
1143
+ isAllowed ? t('pluginStateAllowed') : t('pluginStateBlocked'),
1144
+ ),
1145
+ );
1146
+ }),
1147
+ ),
1148
+ h('div', { className: 'dshr-label' }, t('pluginCoreNote')),
1149
+ h('div', { className: 'dshr-row' },
1150
+ h('button', {
1151
+ type: 'submit',
1152
+ id: 'dshr-save-plugin-policy-btn',
1153
+ className: 'dshr-btn dshr-btn-primary',
1154
+ disabled: busy === 'plugin-policy' || !pluginDirty,
1155
+ }, busy === 'plugin-policy' ? t('saving') : t('savePluginPolicy')),
1156
+ pluginDirty && h('button', {
1157
+ type: 'button',
1158
+ id: 'dshr-reset-plugin-policy-btn',
1159
+ className: 'dshr-btn',
1160
+ onClick: handleDiscardPluginDrafts,
1161
+ }, t('resetDraft')),
1162
+ ),
1163
+ isRemote && pluginReloadNeeded && h('div', { className: 'dshr-notice', id: 'dshr-remote-reload-banner' },
1164
+ h('div', { className: 'dshr-row', style: { justifyContent: 'space-between' } },
1165
+ h('span', null, t('pluginPolicySavedRemote')),
1166
+ h('button', {
1167
+ type: 'button',
1168
+ id: 'dshr-remote-reload-workbench',
1169
+ className: 'dshr-btn dshr-btn-primary',
1170
+ onClick: () => { window.location.reload(); },
1171
+ }, t('reloadWorkbenchBtn')),
1172
+ ),
1173
+ ),
1174
+ ),
1175
+ );
1176
+ };
1177
+
907
1178
  // ---- Remote Restricted Session View ----
908
1179
  if (isRemote) {
909
1180
  const mode = shellSnap?.transportState || shellSnap?.transport || 'Relay';
@@ -925,6 +1196,7 @@
925
1196
  isReconnecting ? t('remoteReconnecting') : (isP2p ? t('remoteP2p') : t('remoteRelay')),
926
1197
  ),
927
1198
  ),
1199
+ toast && !pluginReloadNeeded && h('div', { className: 'dshr-notice', role: 'status' }, toast),
928
1200
  h('div', { className: 'dshr-card' },
929
1201
  h('div', { className: 'dshr-card-head' },
930
1202
  h('h3', { className: 'dshr-card-title' }, `${t('remoteChannel')} · ${hostName}`),
@@ -950,6 +1222,7 @@
950
1222
  }, t('lockForgetBtn')),
951
1223
  ),
952
1224
  ),
1225
+ renderPluginAccessCard(),
953
1226
  ),
954
1227
  );
955
1228
  }
@@ -960,8 +1233,9 @@
960
1233
  const relayConnected = Boolean(overview?.bridge?.relayConnected);
961
1234
  const sessions = overview?.bridge?.sessions || [];
962
1235
  const endpoint = overview?.web?.endpoint || '';
963
- const installedPlugins = overview?.installedWebPlugins || [];
964
1236
  const tokenExpiresAt = overview?.function?.expiresAt;
1237
+ const bridgeConflict = overview?.bridgeConflict || null;
1238
+ const relayHostConflict = Boolean(overview?.bridge?.hostConflict);
965
1239
 
966
1240
  const startProvisionRequest = async (payload) => {
967
1241
  setBusy('provision');
@@ -1082,7 +1356,6 @@
1082
1356
  hostName: hostNameDraft.trim(),
1083
1357
  p2pEnabled: p2pDraft,
1084
1358
  stunUrls: stunUrls.length ? stunUrls : 'none',
1085
- allowedWebPlugins: pluginsDraft,
1086
1359
  }),
1087
1360
  });
1088
1361
  if (resp.ok) {
@@ -1204,6 +1477,22 @@
1204
1477
 
1205
1478
  toast && h('div', { className: 'dshr-notice', role: 'status' }, toast),
1206
1479
 
1480
+ showConfiguredPanel && (bridgeConflict || relayHostConflict) && h('div', {
1481
+ className: 'dshr-card',
1482
+ id: 'dshr-bridge-conflict-banner',
1483
+ role: 'alert',
1484
+ },
1485
+ h('div', { className: 'dshr-card-head' },
1486
+ h('h3', { className: 'dshr-card-title' }, t('conflictBannerTitle')),
1487
+ bridgeConflict?.ownerPid && h('span', { className: 'dshr-badge' }, `PID ${bridgeConflict.ownerPid}`),
1488
+ ),
1489
+ h('div', { className: 'dshr-warn' },
1490
+ bridgeConflict
1491
+ ? `${t('conflictBannerOwnedByOther')}${bridgeConflict.ownerOrigin ? ` (${bridgeConflict.ownerOrigin})` : ''}`
1492
+ : t('conflictBannerRelayKicked'),
1493
+ ),
1494
+ ),
1495
+
1207
1496
  // Explicit admin load error card (prevents falsely rendering "Not bound yet" on 403/5xx/network failure)
1208
1497
  isAdminLoadError && h('div', { className: 'dshr-card', id: 'dshr-admin-error-card', role: 'alert' },
1209
1498
  h('div', { className: 'dshr-card-head' },
@@ -1429,7 +1718,10 @@
1429
1718
  ),
1430
1719
  ),
1431
1720
 
1432
- // Card 4: Host, Network, Plugin Allowlist & Switch/Rebind Cloud App
1721
+ // Card 4: Remote Plugin Access Policy (Blacklist / Whitelist)
1722
+ showConfiguredPanel && renderPluginAccessCard(),
1723
+
1724
+ // Card 5: Host, Network & Switch/Rebind Cloud App
1433
1725
  showConfiguredPanel && h('div', { className: 'dshr-card' },
1434
1726
  h('form', { style: { display: 'grid', gap: 14 }, onSubmit: handleSaveSettings },
1435
1727
  h('div', { className: 'dshr-card-head' },
@@ -1465,24 +1757,6 @@
1465
1757
  onChange: (e) => { markDirty(); setStunDraft(e.target.value); },
1466
1758
  }),
1467
1759
  ),
1468
- installedPlugins.length > 0 && h('div', { className: 'dshr-field' },
1469
- h('span', { className: 'dshr-label' }, t('allowedPlugins')),
1470
- h('div', { className: 'dshr-row' },
1471
- installedPlugins.map((pkg) => h('label', { key: pkg, className: 'dshr-badge', style: { cursor: 'pointer' } },
1472
- h('input', {
1473
- type: 'checkbox',
1474
- checked: pluginsDraft.includes(pkg),
1475
- onChange: (e) => {
1476
- markDirty();
1477
- setPluginsDraft((prev) => e.target.checked
1478
- ? [...new Set([...prev, pkg])]
1479
- : prev.filter((item) => item !== pkg));
1480
- },
1481
- }),
1482
- pkg,
1483
- )),
1484
- ),
1485
- ),
1486
1760
  h('div', { className: 'dshr-row' },
1487
1761
  h('button', { type: 'submit', id: 'dshr-save-settings-btn', className: 'dshr-btn dshr-btn-primary', disabled: busy === 'settings' },
1488
1762
  busy === 'settings' ? t('saving') : t('saveSettings')),