Update App.jsx via upload script - 2026-11-12 15:25:31
This commit is contained in:
parent
d4f7b138c5
commit
499ddeceda
35
App.jsx
35
App.jsx
|
|
@ -1858,8 +1858,6 @@ const Styles = () => (
|
|||
.jms-link-url { flex: 1; min-width: 0; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--bg); color: var(--ink); }
|
||||
.jms-link-url:focus { outline: none; border-color: var(--ink-soft); background: var(--panel); }
|
||||
.jms-link-btn { padding: 4px 6px; flex-shrink: 0; }
|
||||
.jms-link-add { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--ink-soft); background: none; border: 1px dashed var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
|
||||
.jms-link-add:hover { color: var(--ink); border-color: var(--ink-soft); }
|
||||
.jms-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
|
||||
.jms-card-actions .btn { flex: 1; justify-content: center; }
|
||||
|
||||
|
|
@ -6434,8 +6432,6 @@ function JmsLineCard({ line, idx, ip, dragIdx, onDragStart, onDropCard, onDragEn
|
|||
const hasMethod = line.protocol === 'ss' && !!line.method;
|
||||
const autoLink = line.addr && line.port ? jmsBuildLink(line) : '';
|
||||
const isCustom = !!String(line.link || '').trim();
|
||||
const extras = Array.isArray(line.extraLinks) ? line.extraLinks : [];
|
||||
const setExtra = (i, patch) => onPatch({ extraLinks: extras.map((x, k) => (k === i ? { ...x, ...patch } : x)) });
|
||||
const copyUrl = (url) => jmsCopyText(url, '链接', onNotify);
|
||||
|
||||
return (
|
||||
|
|
@ -6499,19 +6495,6 @@ function JmsLineCard({ line, idx, ip, dragIdx, onDragStart, onDropCard, onDragEn
|
|||
onQr={(u) => onQr(line, u)}
|
||||
onReset={isCustom && autoLink ? () => onPatch({ link: '' }) : null}
|
||||
/>
|
||||
{extras.map((x, i) => (
|
||||
<JmsLinkRow
|
||||
key={i}
|
||||
label={x.name || ''}
|
||||
url={x.url || ''}
|
||||
onNameChange={(v) => setExtra(i, { name: v })}
|
||||
onUrlChange={(v) => setExtra(i, { url: v })}
|
||||
onCopy={copyUrl}
|
||||
onQr={(u) => onQr(line, u, x.name)}
|
||||
onRemove={() => onPatch({ extraLinks: extras.filter((_, k) => k !== i) })}
|
||||
/>
|
||||
))}
|
||||
<button className="jms-link-add" onClick={() => onPatch({ extraLinks: [...extras, { name: `链接${extras.length + 2}`, url: '' }] })}><Plus size={12} />添加链接</button>
|
||||
</div>
|
||||
<div className="jms-card-actions">
|
||||
<button className="btn btn-sm" onClick={() => onCopy(line)}><Copy size={13} />复制链接</button>
|
||||
|
|
@ -6641,14 +6624,13 @@ function JmsPage({ lines, onSave, onDelete, onReorder, onNotify }) {
|
|||
|
||||
function handleProtocolChange(p) {
|
||||
setProtocol(p);
|
||||
setDraft(d => ({ name: d.name, addr: d.addr, port: d.port, link: d.link, extraLinks: d.extraLinks }));
|
||||
setDraft(d => ({ name: d.name, addr: d.addr, port: d.port, link: d.link }));
|
||||
}
|
||||
|
||||
function handleSave() {
|
||||
const hasLink = String(draft.link || '').trim() || (draft.extraLinks || []).some(x => String(x.url || '').trim());
|
||||
const hasLink = String(draft.link || '').trim();
|
||||
if ((!draft.addr || !draft.port) && !hasLink) { onNotify('请填写服务器地址和端口,或直接填写订阅链接'); return; }
|
||||
const extraLinks = (draft.extraLinks || []).map(x => ({ name: String(x.name || '').trim(), url: String(x.url || '').trim() })).filter(x => x.url || x.name);
|
||||
onSave({ ...draft, link: String(draft.link || '').trim(), extraLinks, protocol }, editingId);
|
||||
onSave({ ...draft, link: String(draft.link || '').trim(), protocol }, editingId);
|
||||
closeModal();
|
||||
}
|
||||
|
||||
|
|
@ -6718,17 +6700,6 @@ function JmsPage({ lines, onSave, onDelete, onReorder, onNotify }) {
|
|||
<span className="field-label">订阅链接(可选 · 留空则按上面参数自动生成)</span>
|
||||
<textarea className="input" rows={2} style={{ fontFamily: "'IBM Plex Mono', monospace", fontSize: 12 }} value={draft.link || ''} onChange={e => setDraft(d => ({ ...d, link: e.target.value }))} placeholder={(draft.addr && draft.port && jmsBuildLink({ ...draft, protocol })) || 'ss:// 或 vless:// 链接'} />
|
||||
</div>
|
||||
<div className="field">
|
||||
<span className="field-label">其他链接</span>
|
||||
{(draft.extraLinks || []).map((x, i) => (
|
||||
<div key={i} style={{ display: 'flex', gap: 6, marginBottom: 6 }}>
|
||||
<input className="input" style={{ width: 110, flexShrink: 0 }} value={x.name || ''} placeholder="名称" onChange={e => setDraft(d => ({ ...d, extraLinks: d.extraLinks.map((y, k) => (k === i ? { ...y, name: e.target.value } : y)) }))} />
|
||||
<input className="input" style={{ flex: 1, fontFamily: "'IBM Plex Mono', monospace", fontSize: 12 }} value={x.url || ''} placeholder="链接" onChange={e => setDraft(d => ({ ...d, extraLinks: d.extraLinks.map((y, k) => (k === i ? { ...y, url: e.target.value } : y)) }))} />
|
||||
<button className="btn btn-sm btn-ghost btn-danger" onClick={() => setDraft(d => ({ ...d, extraLinks: d.extraLinks.filter((_, k) => k !== i) }))}><Trash2 size={12} /></button>
|
||||
</div>
|
||||
))}
|
||||
<button className="btn btn-sm" style={{ alignSelf: 'flex-start' }} onClick={() => setDraft(d => ({ ...d, extraLinks: [...(d.extraLinks || []), { name: '', url: '' }] }))}><Plus size={12} />添加链接</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="modal-foot"><button className="btn" onClick={closeModal}>取消</button><button className="btn btn-primary" onClick={handleSave}><Save size={13} />保存</button></div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue