![luci-app-easytier](https://socialify.git.ci/EasyTier/luci-app-easytier/image?custom_description=EasyTier+Installation+Packages+%28IPK+and+APK%29+for+OpenWrt&description=1&font=JetBrains+Mono&forks=1&issues=1&logo=https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F169161851%3Fs%3D200%26v%3D4&name=1&pulls=1&stargazers=1&theme=Auto) # Development Guide English | [简体中文](DEVELOPMENT.md) This document details the development standards and requirements for luci-app-easytier. ## Core Principles **Must be compatible with OpenWrt 18.06 ~ 26.x, using LuCI Lua1 architecture** ## Technology Stack Restrictions ### Backend (Lua) #### ✅ Allowed - Lua 5.1 standard syntax - LuCI Lua1 API: - `luci.controller` - `luci.model.uci` - `luci.http` - `luci.sys` - `nixio.fs` - Standard libraries: `io`, `os`, `string`, `table`, `math` #### ❌ Forbidden - Lua2-specific syntax - New LuCI JS API - Any libraries requiring additional dependencies ### Frontend (JavaScript) #### ✅ Allowed - ES5 syntax - `var` declarations - `function` keyword - `XMLHttpRequest` - Native DOM manipulation - Native event handling #### ❌ Forbidden ```javascript // Forbidden ES6+ syntax let x = 1; // ❌ const y = 2; // ❌ var z = () => {}; // ❌ Arrow functions fetch('/api'); // ❌ async/await // ❌ import/export // ❌ Template literals `${x}` // ❌ Destructuring // ❌ class syntax // ❌ // Forbidden frameworks Vue/React/Angular // ❌ jQuery // ❌ Any build tools // ❌ ``` #### ✅ Correct Example ```javascript var xhr = new XMLHttpRequest(); xhr.open('GET', '/api/status', true); xhr.onload = function() { if (xhr.status === 200) { var data = JSON.parse(xhr.responseText); document.getElementById('status').textContent = data.status; } }; xhr.send(); ``` ## Architecture Design ### Page Rendering Flow ``` User Request → Lua Controller → Render HTM Template → Return HTML ↓ Inject initial data into page ↓ JavaScript enhances interaction ↓ AJAX calls Lua API ↓ Update partial DOM ``` ### File Organization ``` controller/easytier.lua ├── index() # Route registration ├── act_status() # Status API ├── upload_binary() # Upload API └── ... view/easytier/status.htm ├── Lua template code (<%...%>) ├── HTML structure ├── CSS styles (