Update app.py
Browse files5 unmodified lines67891011121 unmodified line141516171819202122232425263 unmodified lines303132333435363738394041424344454647484950515253545556575859606162634 unmodified lines6869707172739 unmodified lines838485868788894 unmodified lines94959697989910010110210310410510610710810911011111211311411511615 unmodified lines13213313413513613713813914014114214314430 unmodified lines17517617717817918018118218318418518618718818919019119219319419519619719819920020120220320486 unmodified lines2912922932942952962975 unmodified linesapp = Flask(__name__)# ==========================================# FRONTEND: Pure IDE, Cinematic Animations & Resizer# ==========================================HTML_TEMPLATE = """<!DOCTYPE html>1 unmodified line<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Twenty IDE | Pure Environment</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>:root {--bg-dark: #030305;--bg-panel: #0a0a0f;--bg-terminal: #01111d; /* Tünd Göy PowerShell */--border-glass: rgba(255, 255, 255, 0.08);--text-main: #f4f4f5;--text-muted: #7a7a8c;3 unmodified lines* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }body { background-color: var(--bg-dark); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }/* --- SPLASH EKRANI --- */#splash {position: fixed; inset: 0; background: #030305;z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center;transition: opacity 1s ease-in-out;}.splash-text {font-size: 60px; font-weight: 200; letter-spacing: 30px; color: var(--color-white);text-shadow: 0 0 40px rgba(255,255,255,0.3); margin-left: 30px;}.splash-sub {font-size: 13px; color: var(--text-muted); letter-spacing: 15px; margin-top: 20px;text-transform: uppercase; margin-left: 15px;}/* --- BAŞLANĞICDA GİZLİ PANELLƏR --- */#top-bar { transform: translateY(-100%); opacity: 0; }#sidebar-left { transform: translateX(-50px); opacity: 0; }#center-panel { transform: translateY(50px); opacity: 0; }/* --- SİNXRON ANİMASİYALAR --- */.anim-top { animation: slideInTop 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }.anim-left { animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s; }.anim-center { animation: slideInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s; }@keyframes slideInTop { to { transform: translateY(0); opacity: 1; } }@keyframes slideInLeft { to { transform: translateX(0); opacity: 1; } }@keyframes slideInUp { to { transform: translateY(0); opacity: 1; } }/* --- ÜST PANEL --- */.top-bar {4 unmodified lines.brand i { color: var(--accent); }.controls { display: flex; align-items: center; gap: 15px; }.run-btn {background: var(--text-main); color: #000; border: none; padding: 8px 25px; border-radius: 4px;cursor: pointer; font-weight: 600; transition: 0.3s; display: flex; align-items: center; gap: 8px;9 unmodified lines.panel { background: var(--bg-panel); display: flex; flex-direction: column; }.panel-title { padding: 15px 20px; font-size: 11px; text-transform: uppercase; letter-spacing: 3px; color: var(--text-muted); border-bottom: 1px solid var(--border-glass); background: rgba(0,0,0,0.4); }/* Sol Panel (Zəngin Fayl Sistemi) */.sidebar-left { width: 280px; border-right: 1px solid var(--border-glass); transition: width 0.4s; }.sidebar-left.collapsed { width: 0; border: none; overflow: hidden; opacity: 0; }.file-list { padding: 20px; flex: 1; overflow-y: auto; font-size: 14px; }4 unmodified lines.file-item:hover { color: white; background: rgba(255,255,255,0.05); }.file-item.active { color: white; background: rgba(255,255,255,0.08); border-left: 2px solid var(--accent); }/* Orta Panel (Editor + Resizer + Terminal) */.center-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #000; }#editor-container { flex: 1; min-height: 100px; }/* DRAG RESİZER (Sürüşdürücü Xətt) */.resizer { height: 6px; background: #15151e; cursor: ns-resize; display: flex; justify-content: center; align-items: center; transition: 0.2s; z-index: 50; border-top: 1px solid #000; border-bottom: 1px solid #000; }.resizer:hover, .resizer:active { background: var(--accent); }.resizer::after { content: ""; width: 50px; height: 2px; background: rgba(255,255,255,0.2); border-radius: 2px; }/* Terminal (Sola yaslanmış, böyük şrift) */.terminal-wrapper { height: 300px; min-height: 100px; background: var(--bg-terminal); display: flex; flex-direction: column; }.terminal-header { background: rgba(0,0,0,0.6); padding: 10px 20px; font-size: 12px; color: #888; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); }#terminal-output {flex: 1; padding: 20px; font-family: 'Consolas', monospace; font-size: 15px;color: #d1d1d1; overflow-y: auto; white-space: pre-wrap; line-height: 1.6;text-align: left; /* Tam sola yaslandı */}.ps-prompt { color: #82aaff; font-weight: bold; }.ps-success { color: #c3e88d; }15 unmodified lines<i class="fa-solid fa-code"></i> TWENTY IDE</div><div class="controls"><button class="run-btn" onclick="runCode()" id="btn-run"><i class="fa-solid fa-play"></i> İcra Et</button></div></div><div class="main-layout"><div class="panel sidebar-left" id="sidebar-left"><div class="panel-title">LAYİHƏ STRUKTURU</div><div class="file-list"><div class="folder"><div class="folder-name"><i class="fa-solid fa-folder-open" style="color:#eac54f;"></i> src</div>30 unmodified lines</div><script>// --- KİNO (CINEMATIC) GİRİŞ ANİMASİYASI ---window.onload = () => {setTimeout(() => {const splash = document.getElementById('splash');splash.style.opacity = '0';// Splash tam solandan sonra panelləri gətiririk (1 saniyə sonra)setTimeout(() => {splash.remove();document.getElementById('top-bar').classList.add('anim-top');document.getElementById('sidebar-left').classList.add('anim-left');document.getElementById('center-panel').classList.add('anim-center');}, 1000);}, 2000); // Ekran 2 saniyə dumanlı qalır};// --- SOL PANELİ AÇ/BAĞLA ---function togglePanel(side) {document.getElementById(`sidebar-${side}`).classList.toggle('collapsed');if(editor) setTimeout(() => editor.layout(), 400);}// --- SÜRÜŞDÜRÜCÜ (RESIZER) MƏNTİQİ ---const resizer = document.getElementById('resizer');const terminalWrapper = document.getElementById('terminal-wrapper');let isResizing = false;86 unmodified linestemp_file.write(code)temp_filepath = temp_file.nametry:# Kodun icra olunmasıresult = subprocess.run(['python', temp_filepath], capture_output=True, text=True, timeout=10)if result.returncode == 0:return jsonify({"status": "success", "output": result.stdout})5 unmodified lines67891011121 unmodified line141516171819202122232425263 unmodified lines303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980814 unmodified lines868788899091929394959697989 unmodified lines1081091101111121131144 unmodified lines11912012112212312412512612712812913013113213313413513613713813914015 unmodified lines15615715815916016116216316416516616716816917017117217317430 unmodified lines20520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524686 unmodified lines3333343353363373385 unmodified linesapp = Flask(__name__)# ==========================================# FRONTEND: The Ultimate Cinematic IDE# ==========================================HTML_TEMPLATE = """<!DOCTYPE html>1 unmodified line<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Twenty IDE | Pure Cinematic Environment</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"><style>:root {--bg-dark: #020203;--bg-panel: #0a0a0f;--bg-terminal: #010f1a;--border-glass: rgba(255, 255, 255, 0.08);--text-main: #f4f4f5;--text-muted: #7a7a8c;3 unmodified lines* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', system-ui, sans-serif; }body { background-color: var(--bg-dark); color: var(--text-main); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }/* --- SİRR Lİ KÖLGƏ SPLASH EKRANI --- */#splash {position: fixed; inset: 0; background: #020203;z-index: 9999; display: flex; flex-direction: column; justify-content: center; align-items: center;transition: opacity 1s ease-in-out;}.splash-text {font-size: 65px; font-weight: 100; letter-spacing: 35px; color: transparent;margin-left: 35px; /* Hərfləri mərkəzləşdirmək üçün */animation: shadowMelt 3.5s ease-in-out forwards;}.splash-sub {font-size: 13px; color: var(--accent); letter-spacing: 15px; margin-top: 20px;text-transform: uppercase; margin-left: 15px; opacity: 0;animation: subFade 3.5s ease-in-out forwards;}/* Kino effekti: Kölgədən çıxıb kölgəyə qayıtmaq */@keyframes shadowMelt {0% { opacity: 0; filter: blur(30px); text-shadow: 0 0 0px rgba(0, 242, 254, 0); transform: scale(1.1); color: #000; }30% { opacity: 1; filter: blur(0px); text-shadow: 0 0 50px rgba(0, 242, 254, 0.6); transform: scale(1); color: var(--color-white); }70% { opacity: 1; filter: blur(0px); text-shadow: 0 0 50px rgba(0, 242, 254, 0.6); transform: scale(1); color: var(--color-white); }100% { opacity: 0; filter: blur(30px); text-shadow: 0 0 0px rgba(0, 242, 254, 0); transform: scale(0.9); color: #000; }}@keyframes subFade {0% { opacity: 0; filter: blur(10px); }30% { opacity: 0.8; filter: blur(0px); }70% { opacity: 0.8; filter: blur(0px); }100% { opacity: 0; filter: blur(10px); }}/* --- BAŞLANĞICDA GİZLİ PANELLƏR --- */#top-bar { transform: translateY(-100%); opacity: 0; }#sidebar-left { transform: translateX(-50px); opacity: 0; }/* Orta panel artıq yuxarıdan gələcək deyə -50px edirik */#center-panel { transform: translateY(-50px); opacity: 0; }/* --- SİNXRON ANİMASİYALAR --- */.anim-top { animation: slideInTop 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }.anim-left { animation: slideInLeft 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.2s; }/* Orta panel üçün yeni yuxarıdan sürüşmə animasiyası */.anim-center-down { animation: slideInDown 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards 0.4s; }@keyframes slideInTop { to { transform: translateY(0); opacity: 1; } }@keyframes slideInLeft { to { transform: translateX(0); opacity: 1; } }@keyframes slideInDown { to { transform: translateY(0); opacity: 1; } }/* --- ÜST PANEL --- */.top-bar {4 unmodified lines.brand i { color: var(--accent); }.controls { display: flex; align-items: center; gap: 15px; }.lang-select {background: transparent; color: var(--text-muted); border: 1px solid var(--border-glass);padding: 6px 10px; border-radius: 4px; cursor: pointer; outline: none; transition: 0.3s;font-size: 13px; letter-spacing: 1px;}.lang-select:hover { color: white; border-color: rgba(255,255,255,0.3); }.run-btn {background: var(--text-main); color: #000; border: none; padding: 8px 25px; border-radius: 4px;cursor: pointer; font-weight: 600; transition: 0.3s; display: flex; align-items: center; gap: 8px;9 unmodified lines.panel { background: var(--bg-panel); display: flex; flex-direction: column; }.panel-title { padding: 15px 20px; font-size: 11px; text-transform: uppercase; letter-spacing: 3px; color: var(--text-muted); border-bottom: 1px solid var(--border-glass); background: rgba(0,0,0,0.4); }/* Sol Panel */.sidebar-left { width: 280px; border-right: 1px solid var(--border-glass); transition: width 0.4s; }.sidebar-left.collapsed { width: 0; border: none; overflow: hidden; opacity: 0; }.file-list { padding: 20px; flex: 1; overflow-y: auto; font-size: 14px; }4 unmodified lines.file-item:hover { color: white; background: rgba(255,255,255,0.05); }.file-item.active { color: white; background: rgba(255,255,255,0.08); border-left: 2px solid var(--accent); }/* Orta Panel */.center-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; background: #000; }#editor-container { flex: 1; min-height: 100px; }/* DRAG RESİZER */.resizer { height: 6px; background: #15151e; cursor: ns-resize; display: flex; justify-content: center; align-items: center; transition: 0.2s; z-index: 50; border-top: 1px solid #000; border-bottom: 1px solid #000; }.resizer:hover, .resizer:active { background: var(--accent); }.resizer::after { content: ""; width: 50px; height: 2px; background: rgba(255,255,255,0.2); border-radius: 2px; }/* Terminal */.terminal-wrapper { height: 300px; min-height: 100px; background: var(--bg-terminal); display: flex; flex-direction: column; }.terminal-header { background: rgba(0,0,0,0.6); padding: 10px 20px; font-size: 12px; color: #888; display: flex; justify-content: space-between; border-bottom: 1px solid rgba(255,255,255,0.05); }#terminal-output {flex: 1; padding: 20px; font-family: 'Consolas', monospace; font-size: 15px;color: #d1d1d1; overflow-y: auto; white-space: pre-wrap; line-height: 1.6; text-align: left;}.ps-prompt { color: #82aaff; font-weight: bold; }.ps-success { color: #c3e88d; }15 unmodified lines<i class="fa-solid fa-code"></i> TWENTY IDE</div><div class="controls"><select class="lang-select" id="lang-select" onchange="changeLanguage()"><option value="az">AZ</option><option value="en">EN</option></select><button class="run-btn" onclick="runCode()" id="btn-run"><i class="fa-solid fa-play"></i> <span id="t-run">İcra Et</span></button></div></div><div class="main-layout"><div class="panel sidebar-left" id="sidebar-left"><div class="panel-title" id="t-explorer">LAYİHƏ STRUKTURU</div><div class="file-list"><div class="folder"><div class="folder-name"><i class="fa-solid fa-folder-open" style="color:#eac54f;"></i> src</div>30 unmodified lines</div><script>// --- DİL DƏYİŞDİRMƏ SİSTEMİ ---function changeLanguage() {const lang = document.getElementById('lang-select').value;if(lang === 'az') {document.getElementById('t-run').innerText = 'İcra Et';document.getElementById('t-explorer').innerText = 'LAYİHƏ STRUKTURU';} else {document.getElementById('t-run').innerText = 'Run Code';document.getElementById('t-explorer').innerText = 'PROJECT STRUCTURE';}}// --- KİNO GİRİŞİ VƏ YUXARIDAN SÜRÜŞMƏ ---window.onload = () => {// Animasiyamız 3.5 saniyədir. Tam yox olanda panelləri gətiririk.setTimeout(() => {const splash = document.getElementById('splash');splash.style.opacity = '0';setTimeout(() => {splash.remove();document.getElementById('top-bar').classList.add('anim-top');document.getElementById('sidebar-left').classList.add('anim-left');// Orta panel artıq yuxarıdan gəlir!document.getElementById('center-panel').classList.add('anim-center-down');}, 800);}, 3500); // 3.5 saniyə shadowMelt animasiyası gözləyir};function togglePanel(side) {document.getElementById(`sidebar-${side}`).classList.toggle('collapsed');if(editor) setTimeout(() => editor.layout(), 400);}// --- SÜRÜŞDÜRÜCÜ (RESIZER) ---const resizer = document.getElementById('resizer');const terminalWrapper = document.getElementById('terminal-wrapper');let isResizing = false;86 unmodified linestemp_file.write(code)temp_filepath = temp_file.nametry:result = subprocess.run(['python', temp_filepath], capture_output=True, text=True, timeout=10)if result.returncode == 0:return jsonify({"status": "success", "output": result.stdout})
app.py+70-29