Files
siphoned-valut/cloudflare/tool/index.html
T

32 lines
13 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html><html lang="fa" dir="rtl"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>به‌روزرسانی سایفوند انرژی</title><link rel="icon" href="/assets/favicon.svg" type="image/svg+xml"><style>
@font-face{font-family:Vazirmatn;src:url('/assets/Vazirmatn-Regular.ttf') format('truetype');font-weight:400 600;font-display:swap}
@font-face{font-family:Vazirmatn;src:url('/assets/Vazirmatn-Bold.ttf') format('truetype');font-weight:700 900;font-display:swap}
:root{color-scheme:dark;--bg:#080f18;--panel:#101c29;--line:#294257;--text:#e8f2fa;--muted:#a5b8cb;--blue:#56d3ff}
*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at 90% 0%,#12374a66,transparent 45%),var(--bg);color:var(--text);font:14px Vazirmatn,Tahoma,sans-serif;line-height:1.9}main{max-width:1060px;margin:36px auto;padding:0 28px 40px}.sprite{position:absolute;width:0;height:0;overflow:hidden}.icon{width:19px;height:19px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}header{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:25px}.brand{display:flex;align-items:center;gap:16px}.vial{width:76px;height:76px;border:1px solid #326581;border-radius:20px;background:#102534;box-shadow:0 0 35px #2ccfff18}.eyebrow{display:flex;align-items:center;gap:7px;color:#8edbf5;font-size:11px}h1{font-size:25px;margin:5px 0;letter-spacing:-.6px}h2{font-size:18px;margin:0;display:flex;align-items:center;gap:10px}h2 .icon{color:var(--blue)}p,small{color:var(--muted)}p{margin:10px 0 18px}small{font-size:11px}.badge{display:flex;align-items:center;gap:8px;background:#112b2e;color:#9cddc9;border:1px solid #2e5556;border-radius:30px;padding:7px 12px;white-space:nowrap;font-size:11px}.flow{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-bottom:24px}.flow>div{display:flex;align-items:center;gap:11px;border:1px solid var(--line);border-radius:12px;padding:12px 16px;background:#0e1b28}.number{display:grid;place-items:center;width:30px;height:30px;border-radius:9px;background:#16394e;color:var(--blue);font-weight:700}.flow small{display:block}.box{padding:25px;border:1px solid var(--line);border-radius:16px;background:linear-gradient(135deg,#12243455,transparent),var(--panel);margin:18px 0;box-shadow:0 14px 45px #0002}.summary{display:flex;gap:12px;align-items:center;background:#0f2331;color:#cdeafb}.summary>.icon{color:var(--blue);width:25px;height:25px}label[for=log]{display:block;font-size:12px;color:#b9cedc;margin-bottom:9px}textarea{width:100%;min-height:215px;background:#080f18;color:#deeffa;border:1px solid #31546e;border-radius:10px;padding:16px;font:13px/1.8 monospace;direction:ltr;resize:vertical;display:block}textarea::placeholder{color:#768fa3}button,.link{font:inherit;font-size:12px;border:1px solid #326485;border-radius:9px;background:#17394f;color:#c7ecff;padding:10px 16px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:8px;text-decoration:none;min-height:43px;transition:background .15s,border-color .15s}button:hover:not(:disabled),.link:hover{background:#214e67;border-color:#64c7ee}button.primary{background:var(--blue);color:#062438;font-weight:700;border-color:var(--blue)}button.primary:hover:not(:disabled){background:#8be1ff}button:disabled{opacity:.4;cursor:not-allowed}.actions,.file-row{display:flex;align-items:center;flex-wrap:wrap;gap:10px;margin-top:16px}.file-row{margin:12px 0 18px}.file-row button{background:transparent;min-height:36px;padding:6px 11px}.file-row small{overflow-wrap:anywhere}button:focus-visible,a:focus-visible,textarea:focus-visible{outline:2px solid #8be1ff;outline-offset:4px}#result{white-space:pre-wrap;color:#a9e8ff;font-size:13px}#result:not(:empty){padding:13px 16px;border-radius:10px;background:#14364955;border:1px solid #2f5970;margin-top:17px}.error{color:#ffb4b4!important;background:#53292c44!important;border-color:#82484c!important}.hidden,[hidden]{display:none!important}.divider{height:1px;background:var(--line);margin:24px 0}.steps{display:block;margin-top:13px;line-height:2}a{color:var(--blue)}#published:not(:empty){margin-top:14px}footer{display:flex;align-items:center;gap:8px;color:#8ea6bb;font-size:11px;padding:7px 2px}.help{margin-top:4px;font-size:12px}.upload-heading{font-size:13px;color:#d2e8f7;margin-bottom:9px}
@media(max-width:650px){main{padding:0 16px 25px;margin-top:22px}header{align-items:flex-start}.brand{gap:10px}.vial{width:51px;height:51px;border-radius:13px}h1{font-size:19px}.badge{display:none}.flow{gap:7px}.flow>div{padding:10px 8px;gap:7px;font-size:11px}.flow small{display:none}.number{width:23px;height:23px}.box{padding:18px}h2{font-size:16px}.actions>button,.actions>.link{flex:1}textarea{min-height:230px;font-size:12px}.eyebrow{font-size:9px}.summary{font-size:12px}.file-row{align-items:flex-start}footer{align-items:flex-start}}
@media(prefers-reduced-motion:reduce){*{transition:none!important}}
</style></head><body><svg aria-hidden="true" class="sprite" xmlns="http://www.w3.org/2000/svg"><symbol id="i-check" viewBox="0 0 24 24"><path d="m9 12 2 2 4-4"/><circle cx="12" cy="12" r="9"/></symbol><symbol id="i-file" viewBox="0 0 24 24"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"/><path d="M14 2v6h6M8 13h8M8 17h5"/></symbol><symbol id="i-bolt" viewBox="0 0 24 24"><path d="m13 2-9 12h7l-1 8 10-12h-7l1-8Z"/></symbol><symbol id="i-cloud" viewBox="0 0 24 24"><path d="M7 17a5 5 0 1 1 .8-9.9A7 7 0 0 1 21 12a3 3 0 0 1-3 5M12 12v10m-4-6 4-4 4 4"/></symbol><symbol id="i-link" viewBox="0 0 24 24"><path d="M10 13a5 5 0 0 0 7 .5l3-3a5 5 0 0 0-7-7l-2 2M14 11a5 5 0 0 0-7-.5l-3 3a5 5 0 0 0 7 7l2-2"/></symbol><symbol id="i-download" viewBox="0 0 24 24"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M12 3v12m-5-5 5 5 5-5"/></symbol><symbol id="i-external" viewBox="0 0 24 24"><path d="M15 3h6v6m0-6L10 14M9 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-4"/></symbol><symbol id="i-shield" viewBox="0 0 24 24"><path d="M12 22s8-4 8-11V5l-8-3-8 3v6c0 7 8 11 8 11Z"/><path d="m9 12 2 2 4-4"/></symbol></svg><main>
<header><div class="brand"><img class="vial" src="/assets/siphoned-energy.svg" alt="سایفوند انرژی"><div><div class="eyebrow">مدیریت خزانهٔ گیلد</div><h1>به‌روزرسانی سایفوند انرژی</h1></div></div><span class="badge"><svg class="icon" aria-hidden="true"><use href="#i-shield"/></svg> ابزار شخصی و محلی</span></header>
<div class="flow"><div><span class="number">۱</span><span>وارد کردن لاگ<small>پیست یا انتخاب فایل</small></span></div><div><span class="number">۲</span><span>بررسی و ادغام<small>حذف رکوردهای تکراری</small></span></div><div><span class="number">۳</span><span>انتشار وضعیت<small>سایت و تصویر دیسکورد</small></span></div></div>
<div class="box summary"><svg class="icon" aria-hidden="true"><use href="#i-bolt"/></svg><div id="status" role="status">در حال دریافت اطلاعات…</div></div>
<section class="box"><h2><svg class="icon" aria-hidden="true"><use href="#i-file"/></svg> لاگ جدید بانک گیلد</h2><p class="help">تراکنش‌های قبلی حفظ می‌شوند؛ هم‌پوشانی با لاگ‌های قبلی مشکلی ندارد.</p><label for="log">خروجی بازی همراه با عنوان ستون‌ها</label><textarea id="log" spellcheck="false" placeholder='"Date"&#9;"Player"&#9;"Reason"&#9;"Amount"'></textarea>
<div class="file-row"><input id="file" type="file" accept=".txt,.tsv,.csv" hidden><button id="choose"><svg class="icon" aria-hidden="true"><use href="#i-file"/></svg> انتخاب فایل لاگ</button><small id="filename">فایلی انتخاب نشده</small></div>
<div class="actions"><button id="preview"><svg class="icon" aria-hidden="true"><use href="#i-check"/></svg> بررسی لاگ</button><button id="build" class="primary" disabled><svg class="icon" aria-hidden="true"><use href="#i-bolt"/></svg> ادغام و ساخت نسخهٔ جدید</button></div><div id="result" role="status" aria-live="polite"></div></section>
<section class="box"><h2><svg class="icon" aria-hidden="true"><use href="#i-cloud"/></svg> انتشار سایت</h2><p>برای انتشار مستقیم، یک بار حساب کلودفلیر را متصل کنید. ورود و تأیید دسترسی در مرورگر خودتان انجام می‌شود.</p><div class="actions"><button id="connect"><svg class="icon" aria-hidden="true"><use href="#i-link"/></svg> اتصال حساب کلودفلیر</button><button id="deploy" class="primary" disabled><svg class="icon" aria-hidden="true"><use href="#i-cloud"/></svg> انتشار نسخهٔ آماده</button></div><div id="published"></div><div class="divider"></div><div class="upload-heading">بارگذاری از داشبورد کلودفلیر</div><p class="help">بستهٔ آماده را دانلود کنید و در صفحهٔ بارگذاری قرار دهید.</p><div class="actions"><button id="download" disabled><svg class="icon" aria-hidden="true"><use href="#i-download"/></svg> دانلود بستهٔ سایت</button><a class="link" target="_blank" rel="noreferrer" href="https://dash.cloudflare.com/1be1e22e71d56e01fe8fdbf449b341dc/pages/view/siphoned-energy/deployments/new"><svg class="icon" aria-hidden="true"><use href="#i-external"/></svg> باز کردن صفحهٔ بارگذاری</a></div><small class="steps">محیط «Production» را انتخاب کنید، فایل ZIP را بارگذاری کنید و «Save and deploy» را بزنید.</small></section>
<footer><svg class="icon" aria-hidden="true"><use href="#i-shield"/></svg> این ابزار فقط روی کامپیوتر شما اجرا می‌شود. داده‌های قبلی پیش از ادغام پشتیبان‌گیری می‌شوند.</footer></main><script>
const token='__SESSION__',$=id=>document.getElementById(id),num=n=>new Intl.NumberFormat('fa-IR').format(n);let prepared=false,working=false;
async function api(path,data){const response=await fetch(path,{method:data?'POST':'GET',headers:{'x-session':token,...(data?{'Content-Type':'application/json'}:{})},body:data?JSON.stringify(data):undefined});const value=await response.json();if(!response.ok)throw Error(value.error);return value;}
function feedback(text,error=false){$('result').textContent=text;$('result').className=error?'error':'';}
function lock(value){working=value;['preview','build','connect','deploy','download'].forEach(id=>$(id).disabled=value||(id==='build'&&!$('log').dataset.checked)||(['deploy','download'].includes(id)&&!prepared));}
async function status(){const s=await api('/status');$('status').textContent=`${num(s.transactions)} تراکنش · ${num(s.members)} عضو · بالانس ${num(s.balance)} سایفوند انرژی`+(s.auth==='waiting'?' · منتظر تأیید ورود':s.auth==='connected'?' · حساب متصل شد':s.auth==='failed'?' · اتصال انجام نشد':'');return s;}
$('log').oninput=()=>{delete $('log').dataset.checked;$('build').disabled=true;prepared=false;$('deploy').disabled=true;$('download').disabled=true;};
$('choose').onclick=()=>$('file').click();
$('file').onchange=async()=>{const f=$('file').files[0];if(f){$('filename').textContent=f.name;$('log').value=await f.text();$('log').oninput();}};
$('preview').onclick=async()=>{lock(true);try{const r=await api('/preview',{log:$('log').value});feedback(`${num(r.added)} تراکنش جدید\n${num(r.duplicates)} رکورد تکراری\nبالانس پس از ادغام: ${num(r.balance)} سایفوند انرژی`);$('log').dataset.checked='yes';}catch(e){feedback(e.message,true);}finally{lock(false);}};
$('build').onclick=async()=>{lock(true);feedback('در حال ادغام و ساخت تصویر و بستهٔ جدید…');try{const r=await api('/build',{log:$('log').value});prepared=true;feedback(r.message+`\n${num(r.added)} تراکنش اضافه شد؛ ${num(r.duplicates)} رکورد تکراری.`);await status();}catch(e){feedback(e.message,true);}finally{lock(false);}};
$('connect').onclick=async()=>{lock(true);try{const r=await api('/connect',{});feedback(r.message);const timer=setInterval(async()=>{try{const s=await status();if(!s.busy){clearInterval(timer);lock(false);feedback(s.auth==='connected'?'حساب متصل شد؛ نسخهٔ آماده را منتشر کنید.':'اتصال انجام نشد. دوباره تلاش کنید یا فایل ZIP را بارگذاری کنید.',s.auth!=='connected');}}catch(e){clearInterval(timer);lock(false);feedback(e.message,true);}},2000);}catch(e){lock(false);feedback(e.message,true);}};
$('deploy').onclick=async()=>{lock(true);feedback('در حال انتشار روی کلودفلیر…');try{const r=await api('/deploy',{});feedback(r.message);const a=document.createElement('a');a.href=r.url;a.target='_blank';a.rel='noreferrer';a.textContent='مشاهده و اشتراک‌گذاری نسخهٔ جدید';$('published').replaceChildren(a);}catch(e){feedback(e.message+' اگر هنوز متصل نیستید، ابتدا «اتصال حساب کلودفلیر» را بزنید.',true);}finally{lock(false);}};
$('download').onclick=async()=>{try{const response=await fetch('/package',{headers:{'x-session':token}});if(!response.ok)throw Error('ابتدا بسته را بسازید.');const url=URL.createObjectURL(await response.blob()),a=document.createElement('a');a.href=url;a.download='siphoned.zip';a.click();setTimeout(()=>URL.revokeObjectURL(url),10000);}catch(e){feedback(e.message,true);}};
status().catch(e=>feedback(e.message,true));
</script></html>