feat: initial release - Apple Liquid Glass GPS spoofer web panel

This commit is contained in:
akudamatata committed 2026-07-01 12:57:47 +08:00
1 parent fd794f569a
commit ba96af770e
7 files changed
+1459 -1

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
# 访问 Token(留空 = 无需认证,不推荐公网使用)
# 访问地址示例:https://gps.yourdomain.com/?token=your_token
TOKEN=your_secret_token_here
+4
View File
@@ -0,0 +1,4 @@
data/
.env
node_modules/
*.log
+20
View File
@@ -0,0 +1,20 @@
FROM node:20-alpine
# Install openssl (for potential future cert needs)
RUN apk add --no-cache openssl
WORKDIR /app
# Copy app files
COPY server.js .
COPY public/ ./public/
# Data volume (loc.json + favorites.json persisted here)
VOLUME ["/data"]
ENV PORT=8080
ENV DATA_DIR=/data
EXPOSE 8080
CMD ["node", "server.js"]
+66 -1
View File
@@ -1,2 +1,67 @@
# ios-location-spoofer-web
iOS GPS location spoofer web panel - map-based location picker powered by Shadowrocket MITM
> 基于 Shadowrocket MITM 方案的 iOS GPS 欺骗 Web 管理面板。Apple Liquid Glass UI 风格,地图选点,一键锁定位置。
## 功能
- 🗺 **全屏地图选点**:高德矢量 / 高德卫星 / 国际 OSM 三图层,十字准星模式
- 📍 **一键锁定位置**:实时写入服务器,Shadowrocket 自动读取
- ⭐ **收藏夹**:保存常用地点,点击即跳转
- 🔢 **精度参数**:可手动调节海拔、水平精度、垂直精度
- 🔑 **Token 鉴权**:防止他人随意修改你的位置
- 🐳 **零依赖 Docker 部署**:Node.js 内置模块,无需 npm install
## 快速部署
```bash
# 1. 克隆
git clone https://github.com/akudamatata/ios-location-spoofer-web.git
cd ios-location-spoofer-web
# 2. 配置 Token
cp .env.example .env
# 编辑 .env,设置你的 TOKEN
# 3. 启动
docker compose up -d
```
容器监听 `8080` 端口,配合 Nginx 反代到你的 HTTPS 域名即可。
## Nginx 反代示例
```nginx
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
```
## Shadowrocket 配置
在已有的 `iOS Location Spoofer` 模块参数里,将 `configUrl` 改为:
```
configUrl=https://gps.你的域名.com/loc.json?token=你的Token
```
## 使用流程
1. 手机 Safari 访问 `https://gps.你的域名.com`(自动带 Token)
2. 拖动地图,十字准星对准目标位置
3. 点底部「锁定」按钮
4. 去手机 **设置 → 隐私 → 定位服务 → 关掉再开**
5. 定位生效 ✅
## 为什么需要重开定位
iOS 的定位数据有缓存。Shadowrocket 脚本是在 iOS 向苹果服务器请求定位时才触发,重开定位服务会强制 iOS 重新发请求,此时脚本拉到新坐标并注入,定位生效。
## 参考项目
- [mekos2772/ios-location-spoofer](https://github.com/mekos2772/ios-location-spoofer) - 核心 MITM 脚本
## License
MIT
+13
View File
@@ -0,0 +1,13 @@
services:
gps-spoofer:
build: .
container_name: gps-spoofer
restart: unless-stopped
ports:
- "8080:8080"
volumes:
- ./data:/data
environment:
- PORT=8080
- TOKEN=${TOKEN}
- DATA_DIR=/data
+1147
View File
File diff suppressed because it is too large. Load diff
+206
View File
@@ -0,0 +1,206 @@
'use strict';
const http = require('http');
const fs = require('fs');
const path = require('path');
const url = require('url');
/* ── Config ─────────────────────────────────────────────── */
const PORT = parseInt(process.env.PORT || '8080', 10);
const TOKEN = process.env.TOKEN || '';
const DATA_DIR = process.env.DATA_DIR || '/data';
const LOC_FILE = path.join(DATA_DIR, 'loc.json');
const FAV_FILE = path.join(DATA_DIR, 'favorites.json');
const PUBLIC_DIR = path.join(__dirname, 'public');
const DEFAULT_LOC = {
latitude: 37.3349,
longitude: -122.00902,
altitude: 530,
horizontalAccuracy: 39,
verticalAccuracy: 1000
};
/* ── Bootstrap ───────────────────────────────────────────── */
function bootstrap() {
if (!fs.existsSync(DATA_DIR)) fs.mkdirSync(DATA_DIR, { recursive: true });
if (!fs.existsSync(LOC_FILE)) writeJson(LOC_FILE, DEFAULT_LOC);
if (!fs.existsSync(FAV_FILE)) writeJson(FAV_FILE, []);
}
/* ── Helpers ─────────────────────────────────────────────── */
function readJson(file, fallback) {
try { return JSON.parse(fs.readFileSync(file, 'utf8')); }
catch { return fallback; }
}
function writeJson(file, data) {
fs.writeFileSync(file, JSON.stringify(data, null, 2));
}
function send(res, status, type, body) {
const buf = typeof body === 'string' ? Buffer.from(body, 'utf8') : body;
res.writeHead(status, {
'Content-Type': type,
'Content-Length': buf.length,
'Access-Control-Allow-Origin': '*',
'Cache-Control': 'no-store'
});
res.end(buf);
}
function authOk(query) {
return !TOKEN || query.token === TOKEN;
}
function readBody(req) {
return new Promise((resolve, reject) => {
let s = '';
req.on('data', d => s += d);
req.on('end', () => resolve(s));
req.on('error', reject);
});
}
/* ── Static file serving with token injection ───────────── */
const MIME = {
'.html': 'text/html; charset=utf-8',
'.css': 'text/css',
'.js': 'application/javascript',
'.json': 'application/json',
'.png': 'image/png',
'.svg': 'image/svg+xml',
'.ico': 'image/x-icon'
};
function serveFile(res, filePath, inject) {
const abs = path.resolve(filePath);
if (!abs.startsWith(path.resolve(PUBLIC_DIR))) {
return send(res, 403, 'text/plain', 'Forbidden');
}
let data;
try { data = fs.readFileSync(abs); }
catch { return send(res, 404, 'text/plain', 'Not found'); }
const ext = path.extname(abs).toLowerCase();
const type = MIME[ext] || 'application/octet-stream';
if (inject && ext === '.html') {
// Inject runtime config so the page auto-authenticates
const script = `<script>window.__CFG__=${JSON.stringify(inject)};</script>`;
const html = data.toString('utf8').replace('</head>', script + '</head>');
return send(res, 200, type, html);
}
send(res, 200, type, data);
}
/* ── Request handler ─────────────────────────────────────── */
async function handler(req, res) {
const parsed = url.parse(req.url, true);
const pathname = parsed.pathname.replace(/\/+$/, '') || '/';
const query = parsed.query;
const method = req.method.toUpperCase();
/* CORS preflight */
if (method === 'OPTIONS') {
res.writeHead(204, {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET,POST,DELETE,OPTIONS',
'Access-Control-Allow-Headers': 'Content-Type'
});
return res.end();
}
/* ─ GET /loc.json (Shadowrocket reads this) ─ */
if (pathname === '/loc.json' && method === 'GET') {
if (!authOk(query)) return send(res, 401, 'application/json', '{"error":"unauthorized"}');
return send(res, 200, 'application/json', JSON.stringify(readJson(LOC_FILE, DEFAULT_LOC)));
}
/* ─ POST /set (web UI saves coords) ─ */
if (pathname === '/set' && method === 'POST') {
if (!authOk(query)) return send(res, 401, 'application/json', '{"error":"unauthorized"}');
try {
const body = await readBody(req);
const data = JSON.parse(body);
const current = readJson(LOC_FILE, DEFAULT_LOC);
const updated = { ...current };
if (typeof data.latitude === 'number') updated.latitude = data.latitude;
if (typeof data.longitude === 'number') updated.longitude = data.longitude;
if (typeof data.altitude === 'number') updated.altitude = data.altitude;
if (typeof data.horizontalAccuracy === 'number') updated.horizontalAccuracy = data.horizontalAccuracy;
if (typeof data.verticalAccuracy === 'number') updated.verticalAccuracy = data.verticalAccuracy;
writeJson(LOC_FILE, updated);
return send(res, 200, 'application/json', JSON.stringify(updated));
} catch {
return send(res, 400, 'application/json', '{"error":"bad json"}');
}
}
/* ─ GET /favorites ─ */
if (pathname === '/favorites' && method === 'GET') {
if (!authOk(query)) return send(res, 401, 'application/json', '{"error":"unauthorized"}');
return send(res, 200, 'application/json', JSON.stringify(readJson(FAV_FILE, [])));
}
/* ─ POST /favorites ─ */
if (pathname === '/favorites' && method === 'POST') {
if (!authOk(query)) return send(res, 401, 'application/json', '{"error":"unauthorized"}');
try {
const body = await readBody(req);
const data = JSON.parse(body);
const favs = readJson(FAV_FILE, []);
const fav = {
id: Date.now().toString(36),
name: (data.name || '未命名').slice(0, 30),
latitude: data.latitude,
longitude: data.longitude,
altitude: data.altitude ?? null,
horizontalAccuracy: data.horizontalAccuracy ?? null,
verticalAccuracy: data.verticalAccuracy ?? null,
createdAt: new Date().toISOString()
};
favs.unshift(fav); // newest first
if (favs.length > 100) favs.pop(); // cap at 100
writeJson(FAV_FILE, favs);
return send(res, 200, 'application/json', JSON.stringify(fav));
} catch {
return send(res, 400, 'application/json', '{"error":"bad json"}');
}
}
/* ─ DELETE /favorites/:id ─ */
const favDelete = pathname.match(/^\/favorites\/([^/]+)$/);
if (favDelete && method === 'DELETE') {
if (!authOk(query)) return send(res, 401, 'application/json', '{"error":"unauthorized"}');
const id = favDelete[1];
const favs = readJson(FAV_FILE, []).filter(f => f.id !== id);
writeJson(FAV_FILE, favs);
return send(res, 200, 'application/json', '{"ok":true}');
}
/* ─ GET / → index.html with injected config ─ */
if (method === 'GET' && (pathname === '/' || pathname === '')) {
return serveFile(res, path.join(PUBLIC_DIR, 'index.html'), { token: TOKEN });
}
/* ─ Static assets ─ */
if (method === 'GET') {
return serveFile(res, path.join(PUBLIC_DIR, pathname), null);
}
send(res, 405, 'text/plain', 'Method Not Allowed');
}
/* ── Start ───────────────────────────────────────────────── */
bootstrap();
http.createServer((req, res) => {
handler(req, res).catch(err => {
console.error(err);
res.writeHead(500).end('Internal Server Error');
});
}).listen(PORT, () => {
console.log(`\n🛰 GPS Spoofer Web → http://localhost:${PORT}`);
console.log(` Token : ${TOKEN ? TOKEN.slice(0, 4) + '****' : '(none – open access)'}`);
console.log(` Data : ${DATA_DIR}\n`);
});