Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
cache/
tmp
.idea
src/webroot
AdGuardHomeForRoot_*.zip
45 changes: 45 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 变量定义
TMP_DIR := tmp
SRC_DIR := src
BUILD_DIR := $(TMP_DIR)/build
DOWNLOAD_DIR := $(TMP_DIR)/download
WEBUI_DIR := webui

.PHONY: all clean build-webui

all: clean pack-arm64 pack-armv7

# 下载规则
$(DOWNLOAD_DIR)/AdGuardHome_linux_%.tar.gz:
@echo "Downloading AdGuardHome for $*..."
@mkdir -p $(DOWNLOAD_DIR)
curl --connect-timeout 5 --progress-bar -L -o $@ https://github.com/AdguardTeam/AdGuardHome/releases/latest/download/AdGuardHome_linux_$*.tar.gz

# 解压规则
$(DOWNLOAD_DIR)/extracted/%/AdGuardHome/AdGuardHome: $(DOWNLOAD_DIR)/AdGuardHome_linux_%.tar.gz
@echo "Extracting AdGuardHome for $*..."
@mkdir -p $(DOWNLOAD_DIR)/extracted/$*
tar -xzf $< -C $(DOWNLOAD_DIR)/extracted/$*

# WebUI 构建
build-webui:
@echo "Building Web UI..."
cd $(WEBUI_DIR) && pnpm install && pnpm build

# Pack 规则
pack-%: build-webui $(DOWNLOAD_DIR)/extracted/%/AdGuardHome/AdGuardHome
@echo "Packing for $*..."
@mkdir -p $(BUILD_DIR)/$*
cp -vr $(SRC_DIR)/* $(BUILD_DIR)/$*/
@mkdir -p $(BUILD_DIR)/$*/webroot
cp -vr $(WEBUI_DIR)/dist/* $(BUILD_DIR)/$*/webroot/
@mkdir -p $(BUILD_DIR)/$*/bin
cp -v $(DOWNLOAD_DIR)/extracted/$*/AdGuardHome/AdGuardHome $(BUILD_DIR)/$*/bin/AdGuardHome
cd $(BUILD_DIR)/$* && zip -r ../../../AdGuardHomeForRoot_$*.zip *
@echo "Packing for $* completed successfully."

clean:
@echo "Cleaning up..."
rm -rf $(DOWNLOAD_DIR) $(BUILD_DIR) AdGuardHomeForRoot_*.zip


12 changes: 11 additions & 1 deletion src/webroot/index.html
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
<!DOCTYPE html><script>document.location='http://127.0.0.1:3000/'</script>
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>webui</title>
<script type="module" crossorigin src="/assets/index-BzUhdpDj.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html>
24 changes: 24 additions & 0 deletions webui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
23 changes: 23 additions & 0 deletions webui/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'
import tseslint from 'typescript-eslint'
import { defineConfig, globalIgnores } from 'eslint/config'

export default defineConfig([
globalIgnores(['dist/', 'node_modules/']),
{
files: ['**/*.{ts,tsx}'],
extends: [
js.configs.recommended,
tseslint.configs.recommended,
reactHooks.configs.flat.recommended,
reactRefresh.configs.vite,
],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
},
},
])
11 changes: 11 additions & 0 deletions webui/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>webui</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
31 changes: 31 additions & 0 deletions webui/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "webui",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"kernelsu": "^2.1.1",
"react": "^19.2.0",
"react-dom": "^19.2.0"
},
"devDependencies": {
"@eslint/js": "^9.39.1",
"@types/node": "^24.10.1",
"@types/react": "^19.2.5",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^5.1.1",
"eslint": "^9.39.1",
"eslint-plugin-react-hooks": "^7.0.1",
"eslint-plugin-react-refresh": "^0.4.24",
"globals": "^16.5.0",
"typescript": "~5.9.3",
"typescript-eslint": "^8.46.4",
"vite": "^7.2.4"
}
}
Loading