mirror of
https://github.com/xweiba/location-spoofer.git
synced 2026-09-22 14:50:43 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eadeca636d | ||
|
|
b530d52add | ||
|
|
135e26ea7a | ||
|
|
d35d5c788a | ||
|
|
cce2aef58f | ||
|
|
9cea68392e | ||
|
|
fb0ca961a4 | ||
|
|
a666f177e6 |
+21
-12
@@ -52,7 +52,6 @@ struct FirstSetupView: View {
|
||||
@ObservedObject private var runtimeMode = ProxyRuntimeModeStore.shared
|
||||
@ObservedObject private var thirdPartyProxy = ThirdPartyProxyManager.shared
|
||||
@ObservedObject private var thirdPartyClient = ThirdPartyProxyClientStore.shared
|
||||
@ObservedObject private var motionSimulation = MotionSimulationStore.shared
|
||||
@State private var copiedSubscriptionURL = false
|
||||
@State private var copiedMITMHostname = false
|
||||
@State private var screenshotPreview: SetupScreenshotPreview?
|
||||
@@ -394,8 +393,22 @@ struct FirstSetupView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var thirdPartyMITMWarning: some View {
|
||||
Label {
|
||||
Text("iOS 27 beta 6 起,系统已禁止对 gs-loc.apple.com 进行 MITM 拦截。该版本及之后的 beta 版本暂时无法使用本项目,等待后续适配方案。")
|
||||
.font(.footnote)
|
||||
} icon: {
|
||||
Image(systemName: "exclamationmark.triangle.fill")
|
||||
}
|
||||
.foregroundStyle(.orange)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.padding(10)
|
||||
.background(.orange.opacity(0.12), in: RoundedRectangle(cornerRadius: 10))
|
||||
}
|
||||
|
||||
private var thirdPartyClientStep: some View {
|
||||
VStack(alignment: .leading, spacing: 16) {
|
||||
thirdPartyMITMWarning
|
||||
if !setup.message.isEmpty {
|
||||
Label(setup.message, systemImage: "exclamationmark.triangle.fill")
|
||||
.font(.footnote)
|
||||
@@ -464,7 +477,7 @@ struct FirstSetupView: View {
|
||||
|
||||
Text("适配要求")
|
||||
.font(.subheadline.bold())
|
||||
Text("客户端需要支持请求脚本、持久化存储、HTTP 200 JSON 响应、Apple WLOC 响应脚本,以及 gs-loc.apple.com / gs-loc-cn.apple.com 的 HTTPS 解密。保存接口和 WLOC 响应脚本必须读取同一份持久化数据。")
|
||||
Text("客户端需要支持请求脚本、持久化存储、HTTP 200 JSON 响应、Apple WLOC 响应脚本,以及 Apple 定位域名(gs-loc.apple.com、gsp-ssl.ls.apple.com、bluedot.is.autonavi.com 等)的 HTTPS 解密。保存接口和 WLOC 响应脚本必须读取同一份持久化数据。")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
@@ -476,6 +489,7 @@ struct FirstSetupView: View {
|
||||
private var thirdPartyImportStep: some View {
|
||||
let client = thirdPartyClient.selectedClient
|
||||
return VStack(alignment: .leading, spacing: 16) {
|
||||
thirdPartyMITMWarning
|
||||
if showThirdPartyRepairReason {
|
||||
Label(
|
||||
"检测到第三方代理连接异常,请检查模块、MITM 和代理连接后重新检测。",
|
||||
@@ -539,7 +553,7 @@ struct FirstSetupView: View {
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
Text("配置时请使用 gs-loc.apple.com 和 gs-loc-cn.apple.com 两个域名。")
|
||||
Text("配置时请复制下方全部解密域名(含 gsp-ssl.ls.apple.com、bluedot.is.autonavi.com)。")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
@@ -564,11 +578,11 @@ struct FirstSetupView: View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
instructionRow(1, "进入“配置 → 本地文件”,找到带黄点的配置,点击右侧 i 图标。")
|
||||
instructionRow(2, "进入“HTTPS 解密”,开启解密开关。")
|
||||
instructionRow(3, "在域名列表中添加 gs-loc.apple.com 和 gs-loc-cn.apple.com。")
|
||||
instructionRow(3, "在域名列表中添加下方复制的全部解密域名。")
|
||||
setupScreenshot(
|
||||
assetName: "ShadowrocketHTTPSDecryption",
|
||||
title: "配置 HTTPS 解密",
|
||||
caption: "1 开启 HTTPS 解密,2 添加 gs-loc.apple.com 和 gs-loc-cn.apple.com,3 打开证书设置。"
|
||||
caption: "1 开启 HTTPS 解密,2 添加复制的全部解密域名,3 打开证书设置。"
|
||||
)
|
||||
|
||||
mitmHostnameCopyButton
|
||||
@@ -602,7 +616,7 @@ struct FirstSetupView: View {
|
||||
copiedMITMHostname = true
|
||||
} label: {
|
||||
Label(
|
||||
copiedMITMHostname ? "已复制两个解密域名" : "复制两个解密域名",
|
||||
copiedMITMHostname ? "已复制解密域名" : "复制解密域名",
|
||||
systemImage: "doc.on.doc"
|
||||
)
|
||||
.frame(maxWidth: .infinity)
|
||||
@@ -833,17 +847,12 @@ struct FirstSetupView: View {
|
||||
Task { @MainActor in
|
||||
defer { isVerifying = false }
|
||||
do {
|
||||
let response = try await thirdPartyProxy.validateConnection()
|
||||
let advancedFeaturesAvailable = await thirdPartyProxy.refreshAdvancedFeatureAvailability()
|
||||
if !advancedFeaturesAvailable {
|
||||
motionSimulation.setEnabled(false)
|
||||
}
|
||||
let response = try await thirdPartyProxy.query()
|
||||
let elapsedMilliseconds = Int(Date().timeIntervalSince(startedAt) * 1_000)
|
||||
RuntimeLogger.info("APP", "ThirdPartyProxy", "第三方代理连接检测通过", details: [
|
||||
"当前客户端": client.name,
|
||||
"请求动作": "WLOC query",
|
||||
"连接状态": response.latitude == nil || response.longitude == nil ? "已连接,无保存坐标" : "已连接,有保存坐标",
|
||||
"运动状态模拟": advancedFeaturesAvailable ? "支持" : "不支持,已关闭",
|
||||
"耗时毫秒": String(elapsedMilliseconds)
|
||||
])
|
||||
onComplete()
|
||||
|
||||
+31
-92
@@ -25,6 +25,7 @@ struct SettingsView: View {
|
||||
@ObservedObject private var thirdPartyProxy = ThirdPartyProxyManager.shared
|
||||
@ObservedObject private var thirdPartyClient = ThirdPartyProxyClientStore.shared
|
||||
@ObservedObject private var motionSimulation = MotionSimulationStore.shared
|
||||
@ObservedObject private var randomRadius = RandomRadiusStore.shared
|
||||
@ObservedObject private var moduleSource = ThirdPartyModuleSourceStore.shared
|
||||
@Environment(\.dismiss) private var dismiss
|
||||
@State private var activeTip: TipKind?
|
||||
@@ -85,15 +86,23 @@ struct SettingsView: View {
|
||||
}
|
||||
|
||||
Section("定位模拟") {
|
||||
Toggle("运动状态模拟", isOn: motionSimulationBinding)
|
||||
.disabled(
|
||||
modeOperationRunning ||
|
||||
actions.state.isBusy ||
|
||||
thirdPartyProxy.isRequesting
|
||||
)
|
||||
Text("实验性功能,默认关闭。开启后会同时模拟定位响应中的运动状态。")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
if runtimeMode.mode == .localWiFi {
|
||||
Toggle("运动状态模拟", isOn: motionSimulationBinding)
|
||||
.disabled(
|
||||
modeOperationRunning ||
|
||||
actions.state.isBusy ||
|
||||
thirdPartyProxy.isRequesting
|
||||
)
|
||||
Text("实验性功能,默认关闭。开启后会同时模拟定位响应中的运动状态。")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
} else if runtimeMode.mode == .thirdParty {
|
||||
Toggle("随机扰动", isOn: randomRadiusBinding)
|
||||
.disabled(modeOperationRunning || actions.state.isBusy)
|
||||
Text("开启后,下次同步坐标时会给目标点添加随机偏移(默认半径 50 米),避免位置固定在同一点。")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
|
||||
if runtimeMode.mode == .thirdParty {
|
||||
@@ -257,16 +266,6 @@ struct SettingsView: View {
|
||||
} message: {
|
||||
Text("当前虚拟定位和本地代理将停止。App 会删除钥匙串中的设备 CA、立即生成新证书,并打开安装与信任引导。你还需要前往 iOS「设置 → 通用 → VPN 与设备管理」手动删除旧证书,然后重新下载安装并完全信任新证书。")
|
||||
}
|
||||
.task(id: runtimeMode.mode) {
|
||||
guard runtimeMode.mode == .thirdParty, !modeOperationRunning else { return }
|
||||
if !(await thirdPartyProxy.refreshAdvancedFeatureAvailability()) {
|
||||
disableUnsupportedThirdPartyMotionSimulation()
|
||||
}
|
||||
}
|
||||
.onChange(of: thirdPartyProxy.moduleUpdateRecommended) { updateRecommended in
|
||||
guard updateRecommended else { return }
|
||||
disableUnsupportedThirdPartyMotionSimulation()
|
||||
}
|
||||
}
|
||||
|
||||
private func valueRow(_ title: String, value: String) -> some View {
|
||||
@@ -377,51 +376,18 @@ struct SettingsView: View {
|
||||
Binding(
|
||||
get: { motionSimulation.isEnabled },
|
||||
set: { enabled in
|
||||
if runtimeMode.mode == .localWiFi {
|
||||
proxy.applyMotionSimulation(enabled)
|
||||
return
|
||||
}
|
||||
guard thirdPartyProxy.activeSettings?.success == true else {
|
||||
guard enabled else {
|
||||
motionSimulation.setEnabled(false)
|
||||
return
|
||||
}
|
||||
modeOperationRunning = true
|
||||
Task { @MainActor in
|
||||
if await thirdPartyProxy.refreshAdvancedFeatureAvailability() {
|
||||
motionSimulation.setEnabled(true)
|
||||
} else {
|
||||
presentMotionSimulationModuleUpdateAlert()
|
||||
}
|
||||
modeOperationRunning = false
|
||||
}
|
||||
return
|
||||
}
|
||||
modeOperationRunning = true
|
||||
Task { @MainActor in
|
||||
do {
|
||||
_ = try await thirdPartyProxy.updateMotionSimulation(enabled)
|
||||
motionSimulation.setEnabled(enabled)
|
||||
} catch {
|
||||
RuntimeLogger.error(
|
||||
"APP",
|
||||
"ThirdPartyProxy",
|
||||
"同步运动状态设置失败",
|
||||
error: error,
|
||||
details: ["当前客户端": thirdPartyClient.selectedClient.name]
|
||||
)
|
||||
if error as? ThirdPartyProxyError == .moduleOutdated {
|
||||
presentMotionSimulationModuleUpdateAlert()
|
||||
} else {
|
||||
setup.requestThirdPartySetup(message: error.localizedDescription)
|
||||
}
|
||||
}
|
||||
modeOperationRunning = false
|
||||
}
|
||||
proxy.applyMotionSimulation(enabled)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private var randomRadiusBinding: Binding<Bool> {
|
||||
Binding(
|
||||
get: { randomRadius.isEnabled },
|
||||
set: { randomRadius.setEnabled($0) }
|
||||
)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private var thirdPartyConfigurationSection: some View {
|
||||
Section("第三方代理配置") {
|
||||
@@ -442,12 +408,6 @@ struct SettingsView: View {
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.secondary)
|
||||
|
||||
if thirdPartyProxy.moduleUpdateRecommended {
|
||||
Text("当前模块版本较旧,基础坐标功能仍可继续使用。重新导入最新模块后可使用版本检测和运动状态模拟。")
|
||||
.font(.footnote)
|
||||
.foregroundStyle(.orange)
|
||||
}
|
||||
|
||||
if let verificationText = thirdPartyClient.selectedClient.verificationText {
|
||||
HStack {
|
||||
Text("验证状态")
|
||||
@@ -469,7 +429,7 @@ struct SettingsView: View {
|
||||
UIPasteboard.general.string = ThirdPartyProxyManager.interceptionHostnamesText
|
||||
copiedMITMHostnames = true
|
||||
} label: {
|
||||
Label(copiedMITMHostnames ? "已复制两个解密域名" : "复制两个解密域名", systemImage: "doc.on.doc")
|
||||
Label(copiedMITMHostnames ? "已复制解密域名" : "复制解密域名", systemImage: "doc.on.doc")
|
||||
}
|
||||
|
||||
Button {
|
||||
@@ -493,7 +453,7 @@ struct SettingsView: View {
|
||||
.font(.footnote).foregroundStyle(.secondary)
|
||||
}
|
||||
|
||||
Text("复制模块订阅地址后,在对应代理客户端中添加模块/重写订阅,并为 gs-loc.apple.com 和 gs-loc-cn.apple.com 启用 MITM。第三方客户端保存坐标后,即使关闭本 App,坐标仍由代理客户端持久化并继续生效。")
|
||||
Text("复制模块订阅地址后,在对应代理客户端中添加模块/重写订阅,并为复制的全部域名(含 gsp-ssl.ls.apple.com、bluedot.is.autonavi.com)启用 MITM。第三方客户端保存坐标后,即使关闭本 App,坐标仍由代理客户端持久化并继续生效。")
|
||||
.font(.footnote).foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
@@ -531,7 +491,7 @@ struct SettingsView: View {
|
||||
return """
|
||||
App 在设备本地运行一个代理服务器(127.0.0.1:8888)。
|
||||
|
||||
通过 WiFi 手动代理配置,让系统发往 gs-loc.apple.com 和 gs-loc-cn.apple.com 的定位请求经过这个本地代理。代理使用已安装的 CA 证书对 HTTPS 流量做中间人解密,把 Apple 返回的定位坐标改写为你设置的虚拟坐标,再加密返回给系统,从而实现虚拟定位。
|
||||
通过 WiFi 手动代理配置,让系统发往 Apple 定位域名(gs-loc.apple.com、gsp-ssl.ls.apple.com、bluedot.is.autonavi.com 等)的定位请求经过这个本地代理。代理使用已安装的 CA 证书对 HTTPS 流量做中间人解密,把 Apple 返回的定位坐标改写为你设置的虚拟坐标,再加密返回给系统,从而实现虚拟定位。
|
||||
"""
|
||||
}
|
||||
|
||||
@@ -548,8 +508,7 @@ struct SettingsView: View {
|
||||
runtimeMode.setMode(.thirdParty)
|
||||
if runtimeMode.isInitialized(.thirdParty) {
|
||||
do {
|
||||
_ = try await thirdPartyProxy.validateConnection()
|
||||
refreshThirdPartyAdvancedFeatures()
|
||||
_ = try await thirdPartyProxy.query()
|
||||
proxyOperationAlertTitle = "模式已切换"
|
||||
proxyOperationError = "第三方代理模式检测通过。请关闭 Wi-Fi 中的 127.0.0.1:8888 手动代理,避免双重拦截。"
|
||||
} catch {
|
||||
@@ -591,8 +550,7 @@ struct SettingsView: View {
|
||||
let startedAt = Date()
|
||||
Task { @MainActor in
|
||||
do {
|
||||
_ = try await thirdPartyProxy.validateConnection()
|
||||
refreshThirdPartyAdvancedFeatures()
|
||||
_ = try await thirdPartyProxy.query()
|
||||
RuntimeLogger.info("APP", "ThirdPartyProxy", "设置页第三方连接检测通过", details: [
|
||||
"当前客户端": client.name,
|
||||
"请求动作": "WLOC query",
|
||||
@@ -618,25 +576,6 @@ struct SettingsView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func refreshThirdPartyAdvancedFeatures() {
|
||||
Task { @MainActor in
|
||||
if !(await thirdPartyProxy.refreshAdvancedFeatureAvailability()) {
|
||||
disableUnsupportedThirdPartyMotionSimulation()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func presentMotionSimulationModuleUpdateAlert() {
|
||||
disableUnsupportedThirdPartyMotionSimulation()
|
||||
proxyOperationAlertTitle = "无法开启运动状态模拟"
|
||||
proxyOperationError = "当前模块脚本不支持运动状态模拟,请重新导入最新模块脚本后再开启。基础坐标功能仍可继续使用。"
|
||||
}
|
||||
|
||||
private func disableUnsupportedThirdPartyMotionSimulation() {
|
||||
guard runtimeMode.mode == .thirdParty else { return }
|
||||
motionSimulation.setEnabled(false)
|
||||
}
|
||||
|
||||
private func openThirdPartySetup(for error: Error) {
|
||||
setup.requestThirdPartySetup(message: error.localizedDescription)
|
||||
dismiss()
|
||||
|
||||
+7
-1
@@ -64,7 +64,13 @@ func isWlocHost(host string) bool {
|
||||
host = h
|
||||
}
|
||||
}
|
||||
return host == "gs-loc.apple.com" || host == "gs-loc-cn.apple.com"
|
||||
switch host {
|
||||
case "gs-loc.apple.com", "gs-loc-cn.apple.com",
|
||||
"gsp-ssl.ls.apple.com", "bluedot.is.autonavi.com",
|
||||
"bluedot.is.autonavi.com.gds.alibabadns.com":
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func newProxy(cert *tls.Certificate) *goproxy.ProxyHttpServer {
|
||||
|
||||
@@ -9,6 +9,9 @@ An open-source project for **iOS location-service research, software development
|
||||
The project uses either an on-device proxy or a third-party proxy client to simulate selected Apple location-service
|
||||
responses in a controlled test environment.
|
||||
|
||||
> ⚠️ **Starting with iOS 27 beta 6, the system blocks MITM interception of `gs-loc.apple.com`.** This project is
|
||||
> temporarily unusable on that version and later betas until a workaround is found.
|
||||
|
||||
[](project.yml)
|
||||
[](project.yml)
|
||||
[](Core/go.mod)
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
项目通过本机代理或第三方代理客户端,对 Apple 定位服务的指定响应进行测试环境模拟,帮助开发者验证应用在
|
||||
不同地理位置和定位场景下的行为。
|
||||
|
||||
> ⚠️ **iOS 27 beta 6 起,系统已禁止对 `gs-loc.apple.com` 进行 MITM 拦截。** 目前该版本及之后的 beta 版本暂时无法使用本项目,等待后续适配方案。
|
||||
|
||||
[](project.yml)
|
||||
[](project.yml)
|
||||
[](Core/go.mod)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=修改 Apple 网络定位返回坐标 | 快捷指令(推荐): 设置地理位置 https://www.icloud.com/shortcuts/a82717d8fdad4e6280866fcf911173f7 清理恢复位置 https://www.icloud.com/shortcuts/f42632d406504f24a2cd163af4fe012f | 选点页面: https://wloc-pages.pages.dev/
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
|
||||
[rewrite_local]
|
||||
^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc url script-response-body https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version) url script-echo-response https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
|
||||
[mitm]
|
||||
hostname = gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,18 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=修改 Apple 网络定位返回坐标 | 快捷指令(推荐): 设置地理位置 https://www.icloud.com/shortcuts/a82717d8fdad4e6280866fcf911173f7 清理恢复位置 https://www.icloud.com/shortcuts/f42632d406504f24a2cd163af4fe012f
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
#!openUrl=https://wloc-pages.pages.dev/
|
||||
|
||||
[Argument]
|
||||
longitude = input, "113.94114", tag=经度(在线选点优先)
|
||||
latitude = input, "22.544577", tag=纬度(在线选点优先)
|
||||
accuracy = input, "25", tag=精度(米)
|
||||
logLevel = select, "info", "off", "error", "warn", "debug", "all", tag=日志级别
|
||||
|
||||
[Script]
|
||||
http-response ^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc script-path=https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js, requires-body=true, binary-body-mode=true, timeout=30, tag=Apple WLOC
|
||||
http-request ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version) script-path=https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js, timeout=10, tag=WLOC Settings
|
||||
|
||||
[MITM]
|
||||
hostname = gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,12 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=修改 Apple 网络定位返回坐标 (Shadowrocket 小火箭) | 快捷指令(推荐): 设置地理位置 https://www.icloud.com/shortcuts/a82717d8fdad4e6280866fcf911173f7 清理恢复位置 https://www.icloud.com/shortcuts/f42632d406504f24a2cd163af4fe012f | 选点页面: https://wloc-pages.pages.dev/
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
#!category=Tools
|
||||
|
||||
[Script]
|
||||
Apple WLOC = type=http-response,pattern=^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc,requires-body=1,binary-body-mode=1,max-size=0,timeout=30,script-path=https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
WLOC Settings = type=http-request,pattern=^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version),requires-body=0,max-size=0,timeout=10,script-path=https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
|
||||
[MITM]
|
||||
hostname = %APPEND% gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,14 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=修改 Apple 网络定位返回坐标 | 快捷指令(推荐): 设置地理位置 https://www.icloud.com/shortcuts/a82717d8fdad4e6280866fcf911173f7 清理恢复位置 https://www.icloud.com/shortcuts/f42632d406504f24a2cd163af4fe012f | 选点页面: https://wloc-pages.pages.dev/
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
#!category=Tools
|
||||
#!arguments=经度:113.94114, 纬度:22.544577, 精度:25, 日志级别:info
|
||||
#!arguments-desc=经度/纬度: 默认坐标(在线选点储存后优先)\n精度: GPS精度(米)\n日志级别: off/error/warn/info/debug/all\n\n使用方法: 打开选点页面 -> 选位置 -> 储存到设备
|
||||
|
||||
[Script]
|
||||
Apple WLOC = type=http-response, pattern="^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc", requires-body=1, binary-body-mode=1, max-size=0, timeout=30, script-path=https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
WLOC Settings = type=http-request, pattern="^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version)", requires-body=0, max-size=0, timeout=10, script-path=https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
|
||||
[MITM]
|
||||
hostname = %APPEND% gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Apple WLOC 定位修改
|
||||
desc: "修改 Apple 网络定位返回坐标 | 快捷指令(推荐): 设置地理位置 https://www.icloud.com/shortcuts/a82717d8fdad4e6280866fcf911173f7 清理恢复位置 https://www.icloud.com/shortcuts/f42632d406504f24a2cd163af4fe012f | 选点页面: https://wloc-pages.pages.dev/"
|
||||
author: xweiba
|
||||
homepage: https://github.com/xweiba/location-spoofer
|
||||
category: Tools
|
||||
|
||||
http:
|
||||
mitm:
|
||||
- "gs-loc.apple.com"
|
||||
- "gs-loc-cn.apple.com"
|
||||
script:
|
||||
- match: ^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc
|
||||
name: WLOC.Location
|
||||
type: response
|
||||
require-body: true
|
||||
binary-mode: true
|
||||
max-size: 0
|
||||
timeout: 30
|
||||
- match: ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version)
|
||||
name: WLOC.Settings
|
||||
type: request
|
||||
require-body: false
|
||||
timeout: 10
|
||||
|
||||
script-providers:
|
||||
WLOC.Location:
|
||||
url: https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
interval: 86400
|
||||
WLOC.Settings:
|
||||
url: https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
interval: 86400
|
||||
@@ -66,6 +66,36 @@ final class MotionSimulationStore: ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class RandomRadiusStore: ObservableObject {
|
||||
static let shared = RandomRadiusStore()
|
||||
|
||||
private enum Key {
|
||||
static let isEnabled = "randomRadius.isEnabled"
|
||||
static let radius = "randomRadius.radius"
|
||||
}
|
||||
|
||||
@Published private(set) var isEnabled: Bool
|
||||
@Published private(set) var radius: Double
|
||||
private let defaults: UserDefaults
|
||||
|
||||
init(defaults: UserDefaults = AppGroup.defaults) {
|
||||
self.defaults = defaults
|
||||
isEnabled = defaults.bool(forKey: Key.isEnabled)
|
||||
radius = defaults.object(forKey: Key.radius) as? Double ?? 50
|
||||
}
|
||||
|
||||
func setEnabled(_ enabled: Bool) {
|
||||
isEnabled = enabled
|
||||
defaults.set(enabled, forKey: Key.isEnabled)
|
||||
}
|
||||
|
||||
func setRadius(_ radius: Double) {
|
||||
self.radius = radius
|
||||
defaults.set(radius, forKey: Key.radius)
|
||||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
final class ThirdPartyModuleSourceStore: ObservableObject {
|
||||
static let shared = ThirdPartyModuleSourceStore()
|
||||
|
||||
@@ -9,21 +9,6 @@ struct ThirdPartyProxySettingsResponse: Decodable, Equatable {
|
||||
let motionSimulationEnabled: Bool?
|
||||
}
|
||||
|
||||
struct ThirdPartyProxyVersionResponse: Decodable, Equatable {
|
||||
let success: Bool
|
||||
let moduleVersion: String
|
||||
let protocolVersion: Int
|
||||
let capabilities: Set<String>
|
||||
|
||||
static let requiredCapabilities: Set<String> = [
|
||||
"wifi", "cellTower", "arpc", "marker", "synthetic", "bare", "motionSimulation"
|
||||
]
|
||||
|
||||
var isCompatible: Bool {
|
||||
success && protocolVersion >= 1 && capabilities.isSuperset(of: Self.requiredCapabilities)
|
||||
}
|
||||
}
|
||||
|
||||
enum ThirdPartyProxyConnectionState: Equatable {
|
||||
case unknown
|
||||
case connected(active: Bool)
|
||||
@@ -36,7 +21,6 @@ enum ThirdPartyProxyError: LocalizedError, Equatable {
|
||||
case rejected(String)
|
||||
case coordinateMismatch
|
||||
case network(String)
|
||||
case moduleOutdated
|
||||
|
||||
var errorDescription: String? {
|
||||
switch self {
|
||||
@@ -50,18 +34,11 @@ enum ThirdPartyProxyError: LocalizedError, Equatable {
|
||||
return "第三方代理保存的坐标与当前选点不一致"
|
||||
case .network(let message):
|
||||
return "第三方代理请求失败:\(message)"
|
||||
case .moduleOutdated:
|
||||
return "模块版本过低,请重新导入模块"
|
||||
}
|
||||
}
|
||||
|
||||
var recoverySuggestion: String {
|
||||
switch self {
|
||||
case .moduleOutdated:
|
||||
return "删除旧模块后,重新复制并导入最新模块"
|
||||
default:
|
||||
return "检查模块、MITM、证书和代理/VPN连接"
|
||||
}
|
||||
return "检查模块、MITM、证书和代理/VPN连接"
|
||||
}
|
||||
|
||||
static func recoverySuggestion(for error: Error) -> String {
|
||||
@@ -81,15 +58,16 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
static let shared = ThirdPartyProxyManager()
|
||||
static let interceptionHostnames = [
|
||||
"gs-loc.apple.com",
|
||||
"gs-loc-cn.apple.com"
|
||||
"gs-loc-cn.apple.com",
|
||||
"gsp-ssl.ls.apple.com",
|
||||
"bluedot.is.autonavi.com",
|
||||
"bluedot.is.autonavi.com.gds.alibabadns.com"
|
||||
]
|
||||
static let interceptionHostnamesText = interceptionHostnames.joined(separator: ", ")
|
||||
static let configurationEndpoint = URL(string: "https://gs-loc.apple.com/wloc-settings/save")!
|
||||
static let versionEndpoint = URL(string: "https://gs-loc.apple.com/wloc-settings/version")!
|
||||
|
||||
@Published private(set) var connectionState: ThirdPartyProxyConnectionState = .unknown
|
||||
@Published private(set) var activeSettings: ThirdPartyProxySettingsResponse?
|
||||
@Published private(set) var moduleUpdateRecommended = false
|
||||
@Published private(set) var isRequesting = false
|
||||
private let requester: any ThirdPartyProxyRequesting
|
||||
|
||||
@@ -125,7 +103,7 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
latitude: wgs84.latitude,
|
||||
longitude: wgs84.longitude,
|
||||
accuracy: favorite.accuracy,
|
||||
motionEnabled: MotionSimulationStore.shared.isEnabled
|
||||
randomRadius: RandomRadiusStore.shared.isEnabled ? RandomRadiusStore.shared.radius : 0
|
||||
))
|
||||
guard response.success else {
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? "第三方代理拒绝保存坐标")
|
||||
@@ -146,84 +124,6 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
return response
|
||||
}
|
||||
|
||||
func updateMotionSimulation(_ enabled: Bool) async throws -> ThirdPartyProxySettingsResponse {
|
||||
guard let current = activeSettings,
|
||||
let latitude = current.latitude,
|
||||
let longitude = current.longitude else {
|
||||
throw ThirdPartyProxyError.rejected("第三方虚拟定位尚未开启")
|
||||
}
|
||||
guard await refreshAdvancedFeatureAvailability() else {
|
||||
throw ThirdPartyProxyError.moduleOutdated
|
||||
}
|
||||
let response = try await perform(action: .save(
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
accuracy: current.accuracy ?? 25,
|
||||
motionEnabled: enabled
|
||||
))
|
||||
guard response.success else {
|
||||
throw ThirdPartyProxyError.rejected(response.error ?? "第三方代理拒绝更新运动状态")
|
||||
}
|
||||
activeSettings = response
|
||||
return response
|
||||
}
|
||||
|
||||
func validateConnection() async throws -> ThirdPartyProxySettingsResponse {
|
||||
try await query()
|
||||
}
|
||||
|
||||
func validateVersion() async throws -> ThirdPartyProxyVersionResponse {
|
||||
guard !isRequesting else {
|
||||
throw ThirdPartyProxyError.rejected("已有第三方代理请求正在执行")
|
||||
}
|
||||
isRequesting = true
|
||||
defer { isRequesting = false }
|
||||
|
||||
var request = URLRequest(url: Self.versionEndpoint)
|
||||
request.httpMethod = "GET"
|
||||
request.cachePolicy = .reloadIgnoringLocalAndRemoteCacheData
|
||||
request.timeoutInterval = 8
|
||||
do {
|
||||
let (data, response) = try await requester.data(for: request)
|
||||
guard let http = response as? HTTPURLResponse, http.statusCode == 200,
|
||||
let version = try? JSONDecoder().decode(ThirdPartyProxyVersionResponse.self, from: data),
|
||||
version.isCompatible else {
|
||||
throw ThirdPartyProxyError.moduleOutdated
|
||||
}
|
||||
RuntimeLogger.info("APP", "ThirdPartyProxy", "第三方模块版本检测通过", details: [
|
||||
"模块版本": version.moduleVersion,
|
||||
"协议版本": String(version.protocolVersion),
|
||||
"能力": version.capabilities.sorted().joined(separator: ",")
|
||||
])
|
||||
return version
|
||||
} catch let error as ThirdPartyProxyError {
|
||||
throw error
|
||||
} catch {
|
||||
throw ThirdPartyProxyError.network(error.localizedDescription)
|
||||
}
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func refreshAdvancedFeatureAvailability() async -> Bool {
|
||||
do {
|
||||
_ = try await validateVersion()
|
||||
moduleUpdateRecommended = false
|
||||
return true
|
||||
} catch {
|
||||
moduleUpdateRecommended = true
|
||||
RuntimeLogger.warning(
|
||||
"APP",
|
||||
"ThirdPartyProxy",
|
||||
"第三方模块不支持高级功能",
|
||||
details: [
|
||||
"版本检测": error.localizedDescription,
|
||||
"处理建议": "基础坐标功能可继续使用;更新模块后可使用运动状态模拟"
|
||||
]
|
||||
)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func clear() async throws {
|
||||
let response = try await perform(action: .clear)
|
||||
guard response.success else {
|
||||
@@ -248,7 +148,7 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
|
||||
private enum Action {
|
||||
case query
|
||||
case save(latitude: Double, longitude: Double, accuracy: Int, motionEnabled: Bool)
|
||||
case save(latitude: Double, longitude: Double, accuracy: Int, randomRadius: Double)
|
||||
case clear
|
||||
}
|
||||
|
||||
@@ -265,15 +165,12 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
components.queryItems = [URLQueryItem(name: "action", value: "query")]
|
||||
case .clear:
|
||||
components.queryItems = [URLQueryItem(name: "action", value: "clear")]
|
||||
case .save(let latitude, let longitude, let accuracy, let motionEnabled):
|
||||
case .save(let latitude, let longitude, let accuracy, let randomRadius):
|
||||
components.queryItems = [
|
||||
URLQueryItem(name: "lon", value: String(format: "%.8f", locale: Locale(identifier: "en_US_POSIX"), longitude)),
|
||||
URLQueryItem(name: "lat", value: String(format: "%.8f", locale: Locale(identifier: "en_US_POSIX"), latitude)),
|
||||
URLQueryItem(name: "acc", value: String(accuracy)),
|
||||
URLQueryItem(
|
||||
name: "motion",
|
||||
value: motionEnabled ? "1" : "0"
|
||||
)
|
||||
URLQueryItem(name: "randomRadius", value: String(randomRadius))
|
||||
]
|
||||
}
|
||||
guard let url = components.url else { throw ThirdPartyProxyError.invalidResponse }
|
||||
@@ -306,8 +203,6 @@ final class ThirdPartyProxyManager: ObservableObject {
|
||||
}
|
||||
|
||||
enum ThirdPartyProxyClient: String, CaseIterable, Identifiable {
|
||||
static let moduleSubscriptionVersion = "1.0.0"
|
||||
|
||||
case shadowrocket
|
||||
case surge
|
||||
case quantumultX
|
||||
@@ -344,26 +239,21 @@ enum ThirdPartyProxyClient: String, CaseIterable, Identifiable {
|
||||
|
||||
@MainActor
|
||||
var subscriptionURL: URL {
|
||||
let url: String
|
||||
let directory = ThirdPartyModuleSourceStore.shared.useMirror
|
||||
? "Resources/ThirdPartyProxyModules"
|
||||
: "ThirdParty/WlocScripts/modules/direct"
|
||||
let prefix = ThirdPartyModuleSourceStore.shared.useMirror
|
||||
? "https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/"
|
||||
: "https://raw.githubusercontent.com/xweiba/location-spoofer/main/"
|
||||
// Third-party modules are served directly from the upstream Yu9191/wloc
|
||||
// repository (mirror via gh-proxy when enabled). We no longer maintain
|
||||
// project-owned module copies, so the URL tracks upstream releases.
|
||||
let fileName: String
|
||||
switch self {
|
||||
case .surge, .egern:
|
||||
url = "\(prefix)\(directory)/wloc.sgmodule"
|
||||
case .quantumultX:
|
||||
url = "\(prefix)\(directory)/wloc.conf"
|
||||
case .loon:
|
||||
url = "\(prefix)\(directory)/wloc.lpx"
|
||||
case .stash:
|
||||
url = "\(prefix)\(directory)/wloc.stoverride"
|
||||
case .shadowrocket:
|
||||
url = "\(prefix)\(directory)/wloc.module"
|
||||
case .surge, .egern: fileName = "wloc.sgmodule"
|
||||
case .quantumultX: fileName = "wloc.conf"
|
||||
case .loon: fileName = "wloc.lpx"
|
||||
case .stash: fileName = "wloc.stoverride"
|
||||
case .shadowrocket: fileName = "wloc.module"
|
||||
}
|
||||
return URL(string: "\(url)?v=\(Self.moduleSubscriptionVersion)")!
|
||||
let base = ThirdPartyModuleSourceStore.shared.useMirror
|
||||
? "https://gh-proxy.org/https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/\(fileName)"
|
||||
: "https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/\(fileName)"
|
||||
return URL(string: base)!
|
||||
}
|
||||
|
||||
var launchURL: URL? {
|
||||
|
||||
@@ -37,48 +37,20 @@ final class ThirdPartyProxyManagerTests: XCTestCase {
|
||||
XCTAssertEqual(latitude, wgs84.latitude, accuracy: 0.000_000_01)
|
||||
XCTAssertEqual(longitude, wgs84.longitude, accuracy: 0.000_000_01)
|
||||
XCTAssertEqual(values["acc"], "20")
|
||||
XCTAssertEqual(values["motion"], "0")
|
||||
XCTAssertEqual(manager.connectionState, .connected(active: true))
|
||||
}
|
||||
|
||||
func testVersionEndpointRequiresProtocolAndCapabilities() async throws {
|
||||
let requester = FakeThirdPartyRequester(body: #"{"success":false,"error":"无已保存的坐标"}"#)
|
||||
let manager = ThirdPartyProxyManager(requester: requester)
|
||||
|
||||
let version = try await manager.validateVersion()
|
||||
|
||||
XCTAssertEqual(requester.lastURL?.path, "/wloc-settings/version")
|
||||
XCTAssertEqual(version.moduleVersion, "1.0.0")
|
||||
XCTAssertTrue(version.isCompatible)
|
||||
}
|
||||
|
||||
func testConnectionUsesLegacySaveQueryEndpoint() async throws {
|
||||
let requester = FakeThirdPartyRequester(body: #"{"success":false,"error":"无已保存的坐标"}"#)
|
||||
let manager = ThirdPartyProxyManager(requester: requester)
|
||||
|
||||
let response = try await manager.validateConnection()
|
||||
let response = try await manager.query()
|
||||
|
||||
XCTAssertFalse(response.success)
|
||||
XCTAssertFalse(manager.moduleUpdateRecommended)
|
||||
XCTAssertEqual(requester.requestedURLs.map(\.path), ["/wloc-settings/save"])
|
||||
XCTAssertEqual(requester.requestedURLs.first?.query, "action=query")
|
||||
}
|
||||
|
||||
func testMissingVersionDisablesOnlyAdvancedFeatures() async {
|
||||
let requester = FakeThirdPartyRequester(
|
||||
body: #"{"success":false,"error":"无已保存的坐标"}"#,
|
||||
versionBody: "not-json"
|
||||
)
|
||||
let manager = ThirdPartyProxyManager(requester: requester)
|
||||
|
||||
let isAvailable = await manager.refreshAdvancedFeatureAvailability()
|
||||
|
||||
XCTAssertFalse(isAvailable)
|
||||
XCTAssertTrue(manager.moduleUpdateRecommended)
|
||||
XCTAssertEqual(manager.connectionState, .unknown)
|
||||
XCTAssertEqual(requester.requestedURLs.map(\.path), ["/wloc-settings/version"])
|
||||
}
|
||||
|
||||
func testLegacyModuleCanStillSaveBasicCoordinates() async throws {
|
||||
let favorite = FavoriteLocation(
|
||||
name: "深圳湾",
|
||||
@@ -94,16 +66,25 @@ final class ThirdPartyProxyManagerTests: XCTestCase {
|
||||
wgs84.longitude,
|
||||
wgs84.latitude
|
||||
)
|
||||
let requester = FakeThirdPartyRequester(body: body, versionBody: "not-json")
|
||||
let requester = FakeThirdPartyRequester(body: body)
|
||||
let manager = ThirdPartyProxyManager(requester: requester)
|
||||
|
||||
let response = try await manager.save(favorite)
|
||||
|
||||
XCTAssertTrue(response.success)
|
||||
XCTAssertFalse(manager.moduleUpdateRecommended)
|
||||
XCTAssertEqual(manager.connectionState, .connected(active: true))
|
||||
XCTAssertEqual(requester.requestedURLs.map(\.path), ["/wloc-settings/save"])
|
||||
XCTAssertNil(requester.requestedURLs.first?.query)
|
||||
let queryComponents = URLComponents(
|
||||
url: try XCTUnwrap(requester.requestedURLs.first),
|
||||
resolvingAgainstBaseURL: false
|
||||
)
|
||||
let values = Dictionary(
|
||||
uniqueKeysWithValues: (queryComponents?.queryItems ?? []).map { ($0.name, $0.value ?? "") }
|
||||
)
|
||||
XCTAssertEqual(values["lon"], String(format: "%.8f", locale: Locale(identifier: "en_US_POSIX"), wgs84.longitude))
|
||||
XCTAssertEqual(values["lat"], String(format: "%.8f", locale: Locale(identifier: "en_US_POSIX"), wgs84.latitude))
|
||||
XCTAssertEqual(values["acc"], "20")
|
||||
XCTAssertEqual(values["randomRadius"], "0")
|
||||
}
|
||||
|
||||
func testBrokenSaveQueryFailsWithoutCheckingVersion() async {
|
||||
@@ -111,7 +92,7 @@ final class ThirdPartyProxyManagerTests: XCTestCase {
|
||||
let manager = ThirdPartyProxyManager(requester: requester)
|
||||
|
||||
do {
|
||||
_ = try await manager.validateConnection()
|
||||
_ = try await manager.query()
|
||||
XCTFail("expected interception failure")
|
||||
} catch {
|
||||
XCTAssertEqual(error as? ThirdPartyProxyError, .moduleNotIntercepted)
|
||||
@@ -144,16 +125,16 @@ final class ThirdPartyProxyManagerTests: XCTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
func testClientLinksUseProjectOwnedMirrorModulesAndVerificationLabels() {
|
||||
func testClientLinksUseUpstreamModulesAndVerificationLabels() {
|
||||
XCTAssertEqual(
|
||||
ThirdPartyProxyManager.interceptionHostnamesText,
|
||||
"gs-loc.apple.com, gs-loc-cn.apple.com"
|
||||
"gs-loc.apple.com, gs-loc-cn.apple.com, gsp-ssl.ls.apple.com, bluedot.is.autonavi.com, bluedot.is.autonavi.com.gds.alibabadns.com"
|
||||
)
|
||||
XCTAssertNil(ThirdPartyProxyClient.shadowrocket.verificationText)
|
||||
XCTAssertTrue(ThirdPartyProxyClient.surge.verificationText?.contains("尚未验证") == true)
|
||||
XCTAssertEqual(ThirdPartyProxyClient.egern.subscriptionURL, ThirdPartyProxyClient.surge.subscriptionURL)
|
||||
XCTAssertTrue(ThirdPartyProxyClient.stash.subscriptionURL.absoluteString.hasPrefix(
|
||||
"https://gh-proxy.org/https://raw.githubusercontent.com/xweiba/location-spoofer/main/"
|
||||
"https://gh-proxy.org/https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/"
|
||||
))
|
||||
let stashComponents = URLComponents(
|
||||
url: ThirdPartyProxyClient.stash.subscriptionURL,
|
||||
@@ -163,10 +144,10 @@ final class ThirdPartyProxyManagerTests: XCTestCase {
|
||||
url: ThirdPartyProxyClient.shadowrocket.subscriptionURL,
|
||||
resolvingAgainstBaseURL: false
|
||||
)
|
||||
XCTAssertEqual(stashComponents?.path, "/https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/ThirdPartyProxyModules/wloc.stoverride")
|
||||
XCTAssertEqual(shadowrocketComponents?.path, "/https://raw.githubusercontent.com/xweiba/location-spoofer/main/Resources/ThirdPartyProxyModules/wloc.module")
|
||||
XCTAssertEqual(stashComponents?.queryItems?.first?.value, ThirdPartyProxyClient.moduleSubscriptionVersion)
|
||||
XCTAssertEqual(shadowrocketComponents?.queryItems?.first?.value, ThirdPartyProxyClient.moduleSubscriptionVersion)
|
||||
XCTAssertEqual(stashComponents?.path, "/https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/wloc.stoverride")
|
||||
XCTAssertEqual(shadowrocketComponents?.path, "/https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/wloc.module")
|
||||
XCTAssertTrue(stashComponents?.queryItems?.isEmpty ?? true)
|
||||
XCTAssertTrue(shadowrocketComponents?.queryItems?.isEmpty ?? true)
|
||||
XCTAssertEqual(ThirdPartyProxyClient.shadowrocket.launchURL?.scheme, "shadowrocket")
|
||||
XCTAssertEqual(ThirdPartyProxyClient.surge.launchURL?.scheme, "surge")
|
||||
XCTAssertEqual(ThirdPartyProxyClient.quantumultX.launchURL?.scheme, "quantumult-x")
|
||||
@@ -190,16 +171,11 @@ final class ThirdPartyProxyManagerTests: XCTestCase {
|
||||
|
||||
private final class FakeThirdPartyRequester: ThirdPartyProxyRequesting {
|
||||
private let data: Data
|
||||
private let versionData: Data
|
||||
private(set) var lastURL: URL?
|
||||
private(set) var requestedURLs: [URL] = []
|
||||
|
||||
init(
|
||||
body: String,
|
||||
versionBody: String = #"{"success":true,"moduleVersion":"1.0.0","protocolVersion":1,"capabilities":["wifi","cellTower","arpc","marker","synthetic","bare","motionSimulation"]}"#
|
||||
) {
|
||||
init(body: String) {
|
||||
data = Data(body.utf8)
|
||||
versionData = Data(versionBody.utf8)
|
||||
}
|
||||
|
||||
func data(for request: URLRequest) async throws -> (Data, URLResponse) {
|
||||
@@ -211,6 +187,6 @@ private final class FakeThirdPartyRequester: ThirdPartyProxyRequesting {
|
||||
httpVersion: "HTTP/1.1",
|
||||
headerFields: ["Content-Type": "application/json"]
|
||||
)!
|
||||
return (request.url?.path == "/wloc-settings/version" ? versionData : data, response)
|
||||
return (data, response)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ MANAGER="$ROOT/Shared/ThirdPartyProxyManager.swift"
|
||||
CONTENT="$ROOT/App/ContentView.swift"
|
||||
SETUP="$ROOT/App/FirstSetupView.swift"
|
||||
SETTINGS="$ROOT/App/SettingsView.swift"
|
||||
MODULES="$ROOT/Resources/ThirdPartyProxyModules"
|
||||
|
||||
grep -q 'return "APP模式"' "$MODE" || fail "APP mode display name is missing"
|
||||
grep -q 'return "第三方代理模式"' "$MODE" || fail "third-party mode display name is missing"
|
||||
@@ -38,27 +37,21 @@ grep -Fq '保存:GET ?lon=<经度>&lat=<纬度>&acc=<精度>' "$SETUP" \
|
||||
grep -Fq '清除:GET ?action=clear' "$SETUP" \
|
||||
|| fail "client integration guidance must document the clear action"
|
||||
|
||||
for file in wloc.module wloc.sgmodule wloc.conf wloc.lpx wloc.stoverride; do
|
||||
test -s "$MODULES/$file" || fail "missing bundled module: $file"
|
||||
grep -q 'gs-loc.apple.com' "$MODULES/$file" \
|
||||
|| fail "$file must include gs-loc.apple.com in its MITM hostnames"
|
||||
grep -q 'gs-loc-cn.apple.com' "$MODULES/$file" \
|
||||
|| fail "$file must include gs-loc-cn.apple.com in its MITM hostnames"
|
||||
done
|
||||
|
||||
grep -q 'Yu9191/wloc/refs/heads/main/modules' "$MANAGER" \
|
||||
|| fail "third-party subscription must point at upstream Yu9191 modules"
|
||||
grep -q 'wloc.sgmodule' "$MANAGER" || fail "Surge/Egern module mapping is missing"
|
||||
grep -q 'wloc.stoverride' "$MANAGER" || fail "Stash must use .stoverride directly"
|
||||
grep -q 'shadowrocket://' "$MANAGER" || fail "Shadowrocket launch URL is missing"
|
||||
for scheme in surge quantumult-x loon stash egern; do
|
||||
grep -q "${scheme}://" "$MANAGER" || fail "$scheme launch URL is missing"
|
||||
done
|
||||
grep -q '复制两个解密域名' "$SETUP" || fail "all clients must expose both MITM hostnames"
|
||||
grep -q 'gs-loc.apple.com 和 gs-loc-cn.apple.com' "$SETUP" \
|
||||
|| fail "setup guidance must name both Apple location hostnames"
|
||||
grep -q '复制解密域名' "$SETUP" || fail "all clients must expose the MITM hostname copy action"
|
||||
grep -q '配置时请复制下方全部解密域名' "$SETUP" \
|
||||
|| fail "setup guidance must direct users to copy all Apple location hostnames"
|
||||
grep -q 'ThirdPartyProxyManager.interceptionHostnamesText' "$SETUP" \
|
||||
|| fail "setup hostname copy actions must use the shared two-host value"
|
||||
|| fail "setup hostname copy actions must use the shared interception hostname value"
|
||||
grep -q 'ThirdPartyProxyManager.interceptionHostnamesText' "$SETTINGS" \
|
||||
|| fail "Settings must expose the shared two-host copy action"
|
||||
|| fail "Settings must expose the shared interception hostname copy action"
|
||||
grep -q '配置 → 模块' "$SETUP" || fail "Shadowrocket module import guidance is missing"
|
||||
grep -q 'HTTPS 解密' "$SETUP" || fail "Shadowrocket HTTPS decryption guidance is missing"
|
||||
! grep -q '当前可测试' "$SETUP" || fail "Shadowrocket must not show the obsolete current-test label"
|
||||
@@ -74,43 +67,19 @@ grep -q 'Label("查看诊断日志"' "$SETUP" \
|
||||
|| fail "third-party connection failure must expose the diagnostics action"
|
||||
! grep -q 'setupActionError = error.localizedDescription' "$SETUP" \
|
||||
|| fail "third-party connection failure must not use the generic failure alert"
|
||||
grep -q 'let response = try await thirdPartyProxy.validateConnection()' "$SETUP" \
|
||||
|| fail "the import page must validate the legacy save/query endpoint"
|
||||
grep -A20 'let response = try await thirdPartyProxy.validateConnection()' "$SETUP" \
|
||||
| grep -q 'refreshAdvancedFeatureAvailability()' \
|
||||
|| fail "the import page must also probe advanced module capabilities"
|
||||
grep -A20 'let response = try await thirdPartyProxy.validateConnection()' "$SETUP" \
|
||||
| grep -q 'motionSimulation.setEnabled(false)' \
|
||||
|| fail "an incompatible module must turn motion simulation off without failing basic setup"
|
||||
grep -A20 'let response = try await thirdPartyProxy.validateConnection()' "$SETUP" | grep -q 'onComplete()' \
|
||||
grep -q 'let response = try await thirdPartyProxy.query()' "$SETUP" \
|
||||
|| fail "the import page must validate the save/query endpoint"
|
||||
grep -A20 'let response = try await thirdPartyProxy.query()' "$SETUP" | grep -q 'onComplete()' \
|
||||
|| fail "a successful third-party connection test must close setup immediately"
|
||||
grep -q 'components.queryItems = \[URLQueryItem(name: "action", value: "query")\]' "$MANAGER" \
|
||||
|| fail "the connection test must preserve the established save?action=query contract"
|
||||
grep -q 'thirdPartyProxy.moduleUpdateRecommended' "$SETTINGS" \
|
||||
|| fail "Settings must react to legacy module compatibility mode"
|
||||
grep -q '当前模块版本较旧,基础坐标功能仍可继续使用' "$SETTINGS" \
|
||||
|| fail "Settings must explain that legacy modules retain basic coordinate support"
|
||||
! grep -A8 'Toggle("运动状态模拟"' "$SETTINGS" | grep -q 'thirdPartyProxy.moduleUpdateRecommended' \
|
||||
|| fail "legacy module compatibility must turn motion simulation off without disabling its toggle"
|
||||
grep -q 'refreshAdvancedFeatureAvailability' "$SETTINGS" \
|
||||
|| fail "Settings must probe advanced module availability independently"
|
||||
grep -A18 'guard thirdPartyProxy.activeSettings?.success == true else' "$SETTINGS" \
|
||||
| grep -q 'refreshAdvancedFeatureAvailability()' \
|
||||
|| fail "enabling inactive third-party motion simulation must validate the version endpoint first"
|
||||
grep -A18 'guard thirdPartyProxy.activeSettings?.success == true else' "$SETTINGS" \
|
||||
| grep -q 'motionSimulation.setEnabled(true)' \
|
||||
|| fail "inactive third-party motion simulation may enable only after version validation succeeds"
|
||||
grep -q 'proxyOperationAlertTitle = "无法开启运动状态模拟"' "$SETTINGS" \
|
||||
|| fail "motion simulation must show a dedicated failure alert when version validation fails"
|
||||
grep -q '请重新导入最新模块脚本后再开启' "$SETTINGS" \
|
||||
|| fail "motion simulation failure must tell the user to update the module script"
|
||||
test "$(grep -c 'presentMotionSimulationModuleUpdateAlert()' "$SETTINGS")" -ge 3 \
|
||||
|| fail "inactive and active motion simulation paths must share the module-update alert"
|
||||
grep -q 'onChange(of: thirdPartyProxy.moduleUpdateRecommended)' "$SETTINGS" \
|
||||
|| fail "Settings must react when an installed module becomes incompatible"
|
||||
grep -A5 'private func disableUnsupportedThirdPartyMotionSimulation()' "$SETTINGS" \
|
||||
| grep -q 'motionSimulation.setEnabled(false)' \
|
||||
|| fail "unsupported third-party modules must force motion simulation off before disabling the toggle"
|
||||
grep -B4 'Toggle("运动状态模拟"' "$SETTINGS" | grep -q 'runtimeMode.mode == .localWiFi' \
|
||||
|| fail "the motion-state toggle must only appear in APP mode"
|
||||
grep -B4 'Toggle("随机扰动"' "$SETTINGS" | grep -q 'runtimeMode.mode == .thirdParty' \
|
||||
|| fail "the random-perturbation toggle must only appear in third-party mode"
|
||||
! grep -q 'validateVersion\|refreshAdvancedFeatureAvailability\|moduleUpdateRecommended' \
|
||||
"$SETUP" "$SETTINGS" "$MANAGER" \
|
||||
|| fail "script version detection must be removed from the app"
|
||||
! grep -q 'thirdPartyTestResult?.success' "$SETUP" \
|
||||
|| fail "a successful third-party test must not leave a separate completion state"
|
||||
grep -q 'setupStep = \.thirdPartyImport' "$ROOT/App/SetupCoordinator.swift" \
|
||||
@@ -155,7 +124,7 @@ test -s "$ROOT/docs/onboarding-screenshots/shadowrocket/shadowrocket-module-impo
|
||||
grep -q 'presentSuccessfulOperationTip(.activation)' "$ROOT/App/MapHomeView.swift" || fail "third-party save must present the activation tip"
|
||||
grep -q 'presentSuccessfulOperationTip(.deactivation)' "$ROOT/App/MapHomeView.swift" || fail "third-party clear must present the deactivation tip"
|
||||
grep -q 'if spoofState == .active' "$ROOT/App/MapHomeView.swift" || fail "manual help must follow the shared spoof state"
|
||||
grep -q 'MARKETING_VERSION: "1.0.5"' "$ROOT/project.yml" || fail "marketing version must be 1.0.5"
|
||||
grep -q 'CURRENT_PROJECT_VERSION: "6"' "$ROOT/project.yml" || fail "build version must be 6"
|
||||
grep -q 'MARKETING_VERSION: "1.0.6"' "$ROOT/project.yml" || fail "marketing version must be 1.0.6"
|
||||
grep -q 'CURRENT_PROJECT_VERSION: "7"' "$ROOT/project.yml" || fail "build version must be 7"
|
||||
|
||||
echo "PASS: third-party proxy mode contract"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# Third-Party Notices
|
||||
|
||||
The generated proxy scripts bundle:
|
||||
|
||||
- `pako` 2.1.0, Copyright (C) 2014-2017 Vitaly Puzrin and contributors, MIT License.
|
||||
- `esbuild` is used only as a development/build dependency and is distributed under the MIT License.
|
||||
Vendored
-19
@@ -1,19 +0,0 @@
|
||||
import { build } from "esbuild";
|
||||
import { mkdir } from "node:fs/promises";
|
||||
|
||||
await mkdir(new URL("./dist/v1/", import.meta.url), { recursive: true });
|
||||
|
||||
for (const [entry, outfile] of [
|
||||
["src/response-entry.js", "dist/v1/wloc.js"],
|
||||
["src/settings-entry.js", "dist/v1/wloc-settings.js"]
|
||||
]) {
|
||||
await build({
|
||||
entryPoints: [entry],
|
||||
outfile,
|
||||
bundle: true,
|
||||
format: "iife",
|
||||
target: ["es2017"],
|
||||
minify: true,
|
||||
legalComments: "eof"
|
||||
});
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
(()=>{var y="1.0.0";var m=["wifi","cellTower","arpc","marker","synthetic","bare","motionSimulation"],c="locationSpoofer.settings.v1";function u(){return typeof $task!="undefined"?"quantumultX":typeof $loon!="undefined"?"loon":typeof $rocket!="undefined"?"shadowrocket":typeof Egern!="undefined"?"egern":typeof $environment!="undefined"&&$environment["stash-version"]?"stash":typeof $environment!="undefined"&&$environment["surge-version"]?"surge":"unknown"}function h(e){let t=u()==="quantumultX"?$prefs.valueForKey(e):$persistentStore.read(e);if(!t)return null;try{return JSON.parse(t)}catch(n){return null}}function l(e,t){let n=t==null?"":JSON.stringify(t);return u()==="quantumultX"?$prefs.setValueForKey(n,e):$persistentStore.write(n,e)}function i(e){let t={status:200,headers:{"Content-Type":"application/json; charset=utf-8"},body:JSON.stringify(e)};u()==="quantumultX"?$done(Object.assign({},t,{status:"HTTP/1.1 200 OK"})):u()==="stash"?$done(t):$done({response:t})}function g(e){let t=e.split("?")[1]||"",n={};return t.split("&").forEach(s=>{if(!s)return;let o=s.indexOf("="),f=o<0?s:s.slice(0,o),d=o<0?"":s.slice(o+1),a=f,p=d;try{a=decodeURIComponent(f.replace(/\+/g," "))}catch($){}try{p=decodeURIComponent(d.replace(/\+/g," "))}catch($){}Object.prototype.hasOwnProperty.call(n,a)||(n[a]=p)}),n}function O(e){let t=e.split("?")[0],n=t.indexOf("://");if(n<0)return t;let s=t.indexOf("/",n+3);return s<0?"/":t.slice(s)}var b=typeof $request=="undefined"?"":$request.url||"",E=O(b),r=g(b);if(E==="/wloc-settings/version")i({success:!0,moduleVersion:y,protocolVersion:1,capabilities:m});else if(r.action==="query"){let e=h(c);i(e&&e.enabled?{success:!0,longitude:e.longitude,latitude:e.latitude,accuracy:e.accuracy,motionSimulationEnabled:e.motionSimulationEnabled===!0}:{success:!1,error:"\u65E0\u5DF2\u4FDD\u5B58\u7684\u5750\u6807"})}else if(r.action==="clear")l(c,null),i({success:!0});else{let e=Number(r.lon!=null?r.lon:r.longitude),t=Number(r.lat!=null?r.lat:r.latitude),n=Number(r.acc!=null?r.acc:r.accuracy!=null?r.accuracy:25);if(!Number.isFinite(e)||!Number.isFinite(t))i({success:!1,error:"\u7F3A\u5C11 lon/lat \u53C2\u6570"});else{let s={enabled:!0,longitude:e,latitude:t,accuracy:n,motionSimulationEnabled:r.motion==="1"},o=l(c,s);i(o?{success:!0,longitude:e,latitude:t,accuracy:n,motionSimulationEnabled:s.motionSimulationEnabled}:{success:!1,error:"\u4FDD\u5B58\u914D\u7F6E\u5931\u8D25"})}}})();
|
||||
-6
File diff suppressed because one or more lines are too long
-11
@@ -1,11 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=Location Spoofer 第三方代理模块
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
|
||||
[rewrite_local]
|
||||
^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc url script-response-body https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version) url script-echo-response https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
|
||||
[mitm]
|
||||
hostname = gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=Location Spoofer 第三方代理模块
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
|
||||
[Script]
|
||||
http-response ^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js, requires-body=true, binary-body-mode=true, timeout=30, tag=Apple WLOC
|
||||
http-request ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version) script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js, timeout=10, tag=WLOC Settings
|
||||
|
||||
[MITM]
|
||||
hostname = gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,12 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=Location Spoofer 第三方代理模块
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
#!category=Tools
|
||||
|
||||
[Script]
|
||||
Apple WLOC = type=http-response,pattern=^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc,requires-body=1,binary-body-mode=1,max-size=0,timeout=30,script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
WLOC Settings = type=http-request,pattern=^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version),requires-body=0,max-size=0,timeout=10,script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
|
||||
[MITM]
|
||||
hostname = %APPEND% gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,12 +0,0 @@
|
||||
#!name=Apple WLOC 定位修改
|
||||
#!desc=Location Spoofer 第三方代理模块
|
||||
#!author=xweiba
|
||||
#!homepage=https://github.com/xweiba/location-spoofer
|
||||
#!category=Tools
|
||||
|
||||
[Script]
|
||||
Apple WLOC = type=http-response, pattern="^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc", requires-body=1, binary-body-mode=1, max-size=0, timeout=30, script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
WLOC Settings = type=http-request, pattern="^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version)", requires-body=0, max-size=0, timeout=10, script-path=https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
|
||||
[MITM]
|
||||
hostname = %APPEND% gs-loc.apple.com, gs-loc-cn.apple.com
|
||||
@@ -1,31 +0,0 @@
|
||||
name: Apple WLOC 定位修改
|
||||
desc: Location Spoofer 第三方代理模块
|
||||
author: xweiba
|
||||
homepage: https://github.com/xweiba/location-spoofer
|
||||
category: Tools
|
||||
|
||||
http:
|
||||
mitm:
|
||||
- "gs-loc.apple.com"
|
||||
- "gs-loc-cn.apple.com"
|
||||
script:
|
||||
- match: ^https?:\/\/gs-loc(-cn)?\.apple\.com\/clls\/wloc
|
||||
name: WLOC.Location
|
||||
type: response
|
||||
require-body: true
|
||||
binary-mode: true
|
||||
max-size: 0
|
||||
timeout: 30
|
||||
- match: ^https?:\/\/gs-loc(-cn)?\.apple\.com\/wloc-settings\/(save|version)
|
||||
name: WLOC.Settings
|
||||
type: request
|
||||
require-body: false
|
||||
timeout: 10
|
||||
|
||||
script-providers:
|
||||
WLOC.Location:
|
||||
url: https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc.js
|
||||
interval: 86400
|
||||
WLOC.Settings:
|
||||
url: https://raw.githubusercontent.com/xweiba/location-spoofer/main/ThirdParty/WlocScripts/dist/v1/wloc-settings.js
|
||||
interval: 86400
|
||||
-508
@@ -1,508 +0,0 @@
|
||||
{
|
||||
"name": "@location-spoofer/wloc-scripts",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@location-spoofer/wloc-scripts",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"pako": "2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "0.25.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/aix-ppc64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/aix-ppc64/-/aix-ppc64-0.25.8.tgz",
|
||||
"integrity": "sha512-urAvrUedIqEiFR3FYSLTWQgLu5tb+m0qZw0NBEasUeo6wuqatkMDaRT+1uABiGXEu5vqgPd7FGE1BhsAIy9QVA==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"aix"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm/-/android-arm-0.25.8.tgz",
|
||||
"integrity": "sha512-RONsAvGCz5oWyePVnLdZY/HHwA++nxYWIX1atInlaW6SEkwq6XkP3+cb825EUcRs5Vss/lGh/2YxAb5xqc07Uw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-arm64/-/android-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-OD3p7LYzWpLhZEyATcTSJ67qB5D+20vbtr6vHlHWSQYhKtzUYrETuWThmzFpZtFsBIxRvhO07+UgVA9m0i/O1w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/android-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/android-x64/-/android-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-yJAVPklM5+4+9dTeKwHOaA+LQkmrKFX96BM0A/2zQrbS6ENCmxc4OVoBs5dPkCCak2roAD+jKCdnmOqKszPkjA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-arm64/-/darwin-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-Jw0mxgIaYX6R8ODrdkLLPwBqHTtYHJSmzzd+QeytSugzQ0Vg4c5rDky5VgkoowbZQahCbsv1rT1KW72MPIkevw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/darwin-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/darwin-x64/-/darwin-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-Vh2gLxxHnuoQ+GjPNvDSDRpoBCUzY4Pu0kBqMBDlK4fuWbKgGtmDIeEC081xi26PPjn+1tct+Bh8FjyLlw1Zlg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-YPJ7hDQ9DnNe5vxOm6jaie9QsTwcKedPvizTVlqWG9GBSq+BuyWEDazlGaDTC5NGU4QJd666V0yqCBL2oWKPfA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/freebsd-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/freebsd-x64/-/freebsd-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-MmaEXxQRdXNFsRN/KcIimLnSJrk2r5H8v+WVafRWz5xdSVmWLoITZQXcgehI2ZE6gioE6HirAEToM/RvFBeuhw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm/-/linux-arm-0.25.8.tgz",
|
||||
"integrity": "sha512-FuzEP9BixzZohl1kLf76KEVOsxtIBFwCaLupVuk4eFVnOZfU+Wsn+x5Ryam7nILV2pkq2TqQM9EZPsOBuMC+kg==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-arm64/-/linux-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-WIgg00ARWv/uYLU7lsuDK00d/hHSfES5BzdWAdAig1ioV5kaFNrtK8EqGcUBJhYqotlUByUKz5Qo6u8tt7iD/w==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ia32": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ia32/-/linux-ia32-0.25.8.tgz",
|
||||
"integrity": "sha512-A1D9YzRX1i+1AJZuFFUMP1E9fMaYY+GnSQil9Tlw05utlE86EKTUA7RjwHDkEitmLYiFsRd9HwKBPEftNdBfjg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-loong64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-loong64/-/linux-loong64-0.25.8.tgz",
|
||||
"integrity": "sha512-O7k1J/dwHkY1RMVvglFHl1HzutGEFFZ3kNiDMSOyUrB7WcoHGf96Sh+64nTRT26l3GMbCW01Ekh/ThKM5iI7hQ==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-mips64el": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-mips64el/-/linux-mips64el-0.25.8.tgz",
|
||||
"integrity": "sha512-uv+dqfRazte3BzfMp8PAQXmdGHQt2oC/y2ovwpTteqrMx2lwaksiFZ/bdkXJC19ttTvNXBuWH53zy/aTj1FgGw==",
|
||||
"cpu": [
|
||||
"mips64el"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-ppc64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-ppc64/-/linux-ppc64-0.25.8.tgz",
|
||||
"integrity": "sha512-GyG0KcMi1GBavP5JgAkkstMGyMholMDybAf8wF5A70CALlDM2p/f7YFE7H92eDeH/VBtFJA5MT4nRPDGg4JuzQ==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-riscv64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-riscv64/-/linux-riscv64-0.25.8.tgz",
|
||||
"integrity": "sha512-rAqDYFv3yzMrq7GIcen3XP7TUEG/4LK86LUPMIz6RT8A6pRIDn0sDcvjudVZBiiTcZCY9y2SgYX2lgK3AF+1eg==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-s390x": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-s390x/-/linux-s390x-0.25.8.tgz",
|
||||
"integrity": "sha512-Xutvh6VjlbcHpsIIbwY8GVRbwoviWT19tFhgdA7DlenLGC/mbc3lBoVb7jxj9Z+eyGqvcnSyIltYUrkKzWqSvg==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/linux-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/linux-x64/-/linux-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-ASFQhgY4ElXh3nDcOMTkQero4b1lgubskNlhIfJrsH5OKZXDpUAKBlNS0Kx81jwOBp+HCeZqmoJuihTv57/jvQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-d1KfruIeohqAi6SA+gENMuObDbEjn22olAR7egqnkCD9DGBG0wsEARotkLgXDu6c4ncgWTZJtN5vcgxzWRMzcw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/netbsd-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/netbsd-x64/-/netbsd-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-nVDCkrvx2ua+XQNyfrujIG38+YGyuy2Ru9kKVNyh5jAys6n+l44tTtToqHjino2My8VAY6Lw9H7RI73XFi66Cg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"netbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-j8HgrDuSJFAujkivSMSfPQSAa5Fxbvk4rgNAS5i3K+r8s1X0p1uOO2Hl2xNsGFppOeHOLAVgYwDVlmxhq5h+SQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openbsd-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openbsd-x64/-/openbsd-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-1h8MUAwa0VhNCDp6Af0HToI2TJFAn1uqT9Al6DJVzdIBAd21m/G0Yfc77KDM3uF3T/YaOgQq3qTJHPbTOInaIQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openbsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/openharmony-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-r2nVa5SIK9tSWd0kJd9HCffnDHKchTGikb//9c7HX+r+wHYCpQrSgxhlY6KWV1nFo1l4KFbsMlHk+L6fekLsUg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/sunos-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/sunos-x64/-/sunos-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-zUlaP2S12YhQ2UzUfcCuMDHQFJyKABkAjvO5YSndMiIkMimPmxA+BYSBikWgsRpvyxuRnow4nS5NPnf9fpv41w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"sunos"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-arm64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-arm64/-/win32-arm64-0.25.8.tgz",
|
||||
"integrity": "sha512-YEGFFWESlPva8hGL+zvj2z/SaK+pH0SwOM0Nc/d+rVnW7GSTFlLBGzZkuSU9kFIGIo8q9X3ucpZhu8PDN5A2sQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-ia32": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-ia32/-/win32-ia32-0.25.8.tgz",
|
||||
"integrity": "sha512-hiGgGC6KZ5LZz58OL/+qVVoZiuZlUYlYHNAmczOm7bs2oE1XriPFi5ZHHrS8ACpV5EjySrnoCKmcbQMN+ojnHg==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@esbuild/win32-x64": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/@esbuild/win32-x64/-/win32-x64-0.25.8.tgz",
|
||||
"integrity": "sha512-cn3Yr7+OaaZq1c+2pe+8yxC8E144SReCQjN6/2ynubzYjvyqZjTXfQJpAcQpsdJq3My7XADANiYGHoFC69pLQw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/esbuild": {
|
||||
"version": "0.25.8",
|
||||
"resolved": "https://registry.npmmirror.com/esbuild/-/esbuild-0.25.8.tgz",
|
||||
"integrity": "sha512-vVC0USHGtMi8+R4Kz8rt6JhEWLxsv9Rnu/lGYbPR8u47B+DCBksq9JarW0zOO7bs37hyOK1l2/oqtbciutL5+Q==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@esbuild/aix-ppc64": "0.25.8",
|
||||
"@esbuild/android-arm": "0.25.8",
|
||||
"@esbuild/android-arm64": "0.25.8",
|
||||
"@esbuild/android-x64": "0.25.8",
|
||||
"@esbuild/darwin-arm64": "0.25.8",
|
||||
"@esbuild/darwin-x64": "0.25.8",
|
||||
"@esbuild/freebsd-arm64": "0.25.8",
|
||||
"@esbuild/freebsd-x64": "0.25.8",
|
||||
"@esbuild/linux-arm": "0.25.8",
|
||||
"@esbuild/linux-arm64": "0.25.8",
|
||||
"@esbuild/linux-ia32": "0.25.8",
|
||||
"@esbuild/linux-loong64": "0.25.8",
|
||||
"@esbuild/linux-mips64el": "0.25.8",
|
||||
"@esbuild/linux-ppc64": "0.25.8",
|
||||
"@esbuild/linux-riscv64": "0.25.8",
|
||||
"@esbuild/linux-s390x": "0.25.8",
|
||||
"@esbuild/linux-x64": "0.25.8",
|
||||
"@esbuild/netbsd-arm64": "0.25.8",
|
||||
"@esbuild/netbsd-x64": "0.25.8",
|
||||
"@esbuild/openbsd-arm64": "0.25.8",
|
||||
"@esbuild/openbsd-x64": "0.25.8",
|
||||
"@esbuild/openharmony-arm64": "0.25.8",
|
||||
"@esbuild/sunos-x64": "0.25.8",
|
||||
"@esbuild/win32-arm64": "0.25.8",
|
||||
"@esbuild/win32-ia32": "0.25.8",
|
||||
"@esbuild/win32-x64": "0.25.8"
|
||||
}
|
||||
},
|
||||
"node_modules/pako": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/pako/-/pako-2.1.0.tgz",
|
||||
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",
|
||||
"license": "(MIT AND Zlib)"
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-16
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "@location-spoofer/wloc-scripts",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build": "node build.mjs",
|
||||
"test": "node --test"
|
||||
},
|
||||
"dependencies": {
|
||||
"pako": "2.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "0.25.8"
|
||||
}
|
||||
}
|
||||
Vendored
-263
@@ -1,263 +0,0 @@
|
||||
export const MOTION_ACTIVITY_TYPE = 63;
|
||||
export const MOTION_ACTIVITY_CONFIDENCE = 467;
|
||||
export const WLOC_MARKER = Uint8Array.from([0, 0, 0, 1, 0, 0]);
|
||||
const UINT32_RANGE = 0x100000000;
|
||||
|
||||
const concat = (...parts) => {
|
||||
const length = parts.reduce((sum, part) => sum + part.length, 0);
|
||||
const out = new Uint8Array(length);
|
||||
let offset = 0;
|
||||
for (const part of parts) {
|
||||
out.set(part, offset);
|
||||
offset += part.length;
|
||||
}
|
||||
return out;
|
||||
};
|
||||
|
||||
const equal = (left, right) =>
|
||||
left.length === right.length && left.every((value, index) => value === right[index]);
|
||||
|
||||
function readVarint(data, offset) {
|
||||
let value = 0;
|
||||
let multiplier = 1;
|
||||
for (let index = 0; index < 10 && offset + index < data.length; index += 1) {
|
||||
const byte = data[offset + index];
|
||||
const chunk = byte & 0x7f;
|
||||
if (value !== null && chunk <= Math.floor((Number.MAX_SAFE_INTEGER - value) / multiplier)) {
|
||||
value += chunk * multiplier;
|
||||
} else {
|
||||
value = null;
|
||||
}
|
||||
if ((byte & 0x80) === 0) return { value, next: offset + index + 1 };
|
||||
multiplier *= 0x80;
|
||||
}
|
||||
throw new Error("invalid varint");
|
||||
}
|
||||
|
||||
function writeVarint(input) {
|
||||
const value = Math.trunc(Number(input));
|
||||
if (!Number.isSafeInteger(value)) throw new Error("varint value is not a safe integer");
|
||||
let low = value >>> 0;
|
||||
let high = Math.floor(value / UINT32_RANGE) >>> 0;
|
||||
const bytes = [];
|
||||
do {
|
||||
const byte = low & 0x7f;
|
||||
low = ((low >>> 7) | ((high & 0x7f) << 25)) >>> 0;
|
||||
high >>>= 7;
|
||||
const hasMore = high !== 0 || low !== 0;
|
||||
bytes.push(byte | (hasMore ? 0x80 : 0));
|
||||
} while (high !== 0 || low !== 0);
|
||||
return Uint8Array.from(bytes);
|
||||
}
|
||||
|
||||
const writeTag = (number, wireType) => writeVarint((number << 3) | wireType);
|
||||
|
||||
function writeLengthDelimited(number, value) {
|
||||
return concat(writeTag(number, 2), writeVarint(value.length), value);
|
||||
}
|
||||
|
||||
export function parseFields(data) {
|
||||
const fields = [];
|
||||
let offset = 0;
|
||||
while (offset < data.length) {
|
||||
const start = offset;
|
||||
const tag = readVarint(data, offset);
|
||||
offset = tag.next;
|
||||
if (!Number.isSafeInteger(tag.value)) throw new Error("protobuf tag is too large");
|
||||
const number = Math.floor(tag.value / 8);
|
||||
const wireType = tag.value & 7;
|
||||
if (number === 0) throw new Error("invalid protobuf field 0");
|
||||
let value;
|
||||
if (wireType === 0) {
|
||||
const item = readVarint(data, offset);
|
||||
value = data.slice(offset, item.next);
|
||||
offset = item.next;
|
||||
} else if (wireType === 1) {
|
||||
if (offset + 8 > data.length) throw new Error("truncated fixed64");
|
||||
value = data.slice(offset, offset + 8);
|
||||
offset += 8;
|
||||
} else if (wireType === 2) {
|
||||
const length = readVarint(data, offset);
|
||||
offset = length.next;
|
||||
const size = length.value;
|
||||
if (!Number.isSafeInteger(size) || offset + size > data.length) {
|
||||
throw new Error("truncated length-delimited field");
|
||||
}
|
||||
value = data.slice(offset, offset + size);
|
||||
offset += size;
|
||||
} else if (wireType === 5) {
|
||||
if (offset + 4 > data.length) throw new Error("truncated fixed32");
|
||||
value = data.slice(offset, offset + 4);
|
||||
offset += 4;
|
||||
} else {
|
||||
throw new Error(`unsupported wire type ${wireType}`);
|
||||
}
|
||||
fields.push({ number, wireType, value, raw: data.slice(start, offset) });
|
||||
}
|
||||
return fields;
|
||||
}
|
||||
|
||||
function patchLocation(data, config, stats) {
|
||||
const fields = parseFields(data);
|
||||
if (!fields.some((field) => field.number === 1 && field.wireType === 0) ||
|
||||
!fields.some((field) => field.number === 2 && field.wireType === 0)) {
|
||||
return data;
|
||||
}
|
||||
let hasMotionType = false;
|
||||
let hasMotionConfidence = false;
|
||||
const parts = fields.map((field) => {
|
||||
if (field.wireType !== 0) return field.raw;
|
||||
if (field.number === 1) return concat(writeTag(1, 0), writeVarint(Math.round(config.latitude * 1e8)));
|
||||
if (field.number === 2) return concat(writeTag(2, 0), writeVarint(Math.round(config.longitude * 1e8)));
|
||||
if (field.number === 3) return concat(writeTag(3, 0), writeVarint(config.accuracy));
|
||||
if (config.motionSimulationEnabled && field.number === 11) {
|
||||
hasMotionType = true;
|
||||
return concat(writeTag(11, 0), writeVarint(MOTION_ACTIVITY_TYPE));
|
||||
}
|
||||
if (config.motionSimulationEnabled && field.number === 12) {
|
||||
hasMotionConfidence = true;
|
||||
return concat(writeTag(12, 0), writeVarint(MOTION_ACTIVITY_CONFIDENCE));
|
||||
}
|
||||
return field.raw;
|
||||
});
|
||||
if (config.motionSimulationEnabled && !hasMotionType) {
|
||||
parts.push(concat(writeTag(11, 0), writeVarint(MOTION_ACTIVITY_TYPE)));
|
||||
}
|
||||
if (config.motionSimulationEnabled && !hasMotionConfidence) {
|
||||
parts.push(concat(writeTag(12, 0), writeVarint(MOTION_ACTIVITY_CONFIDENCE)));
|
||||
}
|
||||
const out = concat(...parts);
|
||||
if (!equal(out, data)) stats.locations += 1;
|
||||
return out;
|
||||
}
|
||||
|
||||
function patchWifi(data, config, stats) {
|
||||
const fields = parseFields(data);
|
||||
const hasMac = fields.some((field) =>
|
||||
field.number === 1 && field.wireType === 2 &&
|
||||
/^[0-9a-fA-F]{1,2}(:[0-9a-fA-F]{1,2}){5}$/.test(
|
||||
Array.from(field.value, (byte) => String.fromCharCode(byte)).join("")
|
||||
)
|
||||
);
|
||||
if (!hasMac) return data;
|
||||
let changed = false;
|
||||
const parts = fields.map((field) => {
|
||||
if (field.number !== 2 || field.wireType !== 2) return field.raw;
|
||||
const value = patchLocation(field.value, config, stats);
|
||||
changed ||= !equal(value, field.value);
|
||||
return writeLengthDelimited(2, value);
|
||||
});
|
||||
if (changed) stats.wifi += 1;
|
||||
return concat(...parts);
|
||||
}
|
||||
|
||||
function patchCell(data, config, stats) {
|
||||
let changed = false;
|
||||
const parts = parseFields(data).map((field) => {
|
||||
if (field.number !== 5 || field.wireType !== 2) return field.raw;
|
||||
const value = patchLocation(field.value, config, stats);
|
||||
changed ||= !equal(value, field.value);
|
||||
return writeLengthDelimited(5, value);
|
||||
});
|
||||
if (changed) stats.cell += 1;
|
||||
return concat(...parts);
|
||||
}
|
||||
|
||||
export function patchPayload(data, config, stats = { wifi: 0, cell: 0, locations: 0 }) {
|
||||
const parts = parseFields(data).map((field) => {
|
||||
if (field.number === 2 && field.wireType === 2) {
|
||||
return writeLengthDelimited(2, patchWifi(field.value, config, stats));
|
||||
}
|
||||
if ((field.number === 22 || field.number === 24) && field.wireType === 2) {
|
||||
return writeLengthDelimited(field.number, patchCell(field.value, config, stats));
|
||||
}
|
||||
return field.raw;
|
||||
});
|
||||
return { data: concat(...parts), stats };
|
||||
}
|
||||
|
||||
const uint16 = (data, offset) => (data[offset] << 8) | data[offset + 1];
|
||||
const uint32 = (data, offset) =>
|
||||
((data[offset] * 0x1000000) + (data[offset + 1] << 16) +
|
||||
(data[offset + 2] << 8) + data[offset + 3]) >>> 0;
|
||||
const writeUint16 = (value) => Uint8Array.from([(value >>> 8) & 0xff, value & 0xff]);
|
||||
const writeUint32 = (value) => Uint8Array.from([
|
||||
(value >>> 24) & 0xff, (value >>> 16) & 0xff, (value >>> 8) & 0xff, value & 0xff
|
||||
]);
|
||||
|
||||
function findBytes(data, marker) {
|
||||
outer: for (let offset = 0; offset <= data.length - marker.length; offset += 1) {
|
||||
for (let index = 0; index < marker.length; index += 1) {
|
||||
if (data[offset + index] !== marker[index]) continue outer;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function patchARPC(body, config) {
|
||||
if (body.length < 2) throw new Error("short ARPC");
|
||||
let offset = 2;
|
||||
for (let index = 0; index < 3; index += 1) {
|
||||
if (offset + 2 > body.length) throw new Error("truncated ARPC string");
|
||||
offset += 2 + uint16(body, offset);
|
||||
}
|
||||
const lengthOffset = offset + 4;
|
||||
const payloadOffset = lengthOffset + 4;
|
||||
if (payloadOffset > body.length) throw new Error("truncated ARPC header");
|
||||
const length = uint32(body, lengthOffset);
|
||||
if (!length || payloadOffset + length > body.length) throw new Error("invalid ARPC length");
|
||||
const patched = patchPayload(body.slice(payloadOffset, payloadOffset + length), config);
|
||||
if (equal(patched.data, body.slice(payloadOffset, payloadOffset + length))) throw new Error("unchanged ARPC");
|
||||
return { data: concat(body.slice(0, lengthOffset), writeUint32(patched.data.length),
|
||||
patched.data, body.slice(payloadOffset + length)), stats: patched.stats };
|
||||
}
|
||||
|
||||
function patchMarker(body, config) {
|
||||
const markerOffset = findBytes(body, WLOC_MARKER);
|
||||
if (markerOffset < 0) throw new Error("marker not found");
|
||||
const lengthOffset = markerOffset + WLOC_MARKER.length;
|
||||
const payloadOffset = lengthOffset + 2;
|
||||
const length = uint16(body, lengthOffset);
|
||||
if (!length || payloadOffset + length > body.length) throw new Error("invalid marker length");
|
||||
const patched = patchPayload(body.slice(payloadOffset, payloadOffset + length), config);
|
||||
if (patched.data.length > 65535 || equal(patched.data, body.slice(payloadOffset, payloadOffset + length))) {
|
||||
throw new Error("unchanged marker");
|
||||
}
|
||||
return { data: concat(body.slice(0, lengthOffset), writeUint16(patched.data.length),
|
||||
patched.data, body.slice(payloadOffset + length)), stats: patched.stats };
|
||||
}
|
||||
|
||||
function patchSynthetic(body, offset, config) {
|
||||
if (offset + 10 > body.length) throw new Error("short frame");
|
||||
const length = uint16(body, offset + 8);
|
||||
if (!length || offset + 10 + length > body.length) throw new Error("invalid frame");
|
||||
const patched = patchPayload(body.slice(offset + 10, offset + 10 + length), config);
|
||||
if (patched.data.length > 65535 || equal(patched.data, body.slice(offset + 10, offset + 10 + length))) {
|
||||
throw new Error("unchanged frame");
|
||||
}
|
||||
return { data: concat(body.slice(0, offset + 8), writeUint16(patched.data.length),
|
||||
patched.data, body.slice(offset + 10 + length)), stats: patched.stats };
|
||||
}
|
||||
|
||||
export function patchWlocBody(body, config) {
|
||||
for (const patcher of [patchARPC, patchMarker]) {
|
||||
try { return patcher(body, config); } catch {}
|
||||
}
|
||||
const offsets = [...new Set([0, 2, 4, 6, 8, 10, 12, 14, 16,
|
||||
...Array.from({ length: Math.min(96, Math.max(0, body.length - 10)) + 1 }, (_, index) => index)])];
|
||||
for (const offset of offsets) {
|
||||
try { return patchSynthetic(body, offset, config); } catch {}
|
||||
}
|
||||
for (let offset = 0; offset <= Math.min(256, body.length); offset += 1) {
|
||||
try {
|
||||
const patched = patchPayload(body.slice(offset), config);
|
||||
if (!equal(patched.data, body.slice(offset))) {
|
||||
return { data: concat(body.slice(0, offset), patched.data), stats: patched.stats };
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
throw new Error("no patchable wloc payload found");
|
||||
}
|
||||
|
||||
export const internals = { concat, writeVarint, writeTag, writeLengthDelimited, equal };
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
import { ungzip } from "pako";
|
||||
import { patchWlocBody } from "./core.js";
|
||||
import {
|
||||
STORAGE_KEY, finishBinary, finishPassthrough, readPersistent, responseBytes
|
||||
} from "./runtime.js";
|
||||
|
||||
try {
|
||||
const settings = readPersistent(STORAGE_KEY);
|
||||
const input = responseBytes();
|
||||
if (!settings || !settings.enabled || !input.length) {
|
||||
finishPassthrough();
|
||||
} else {
|
||||
const isGzip = input.length >= 2 && input[0] === 0x1f && input[1] === 0x8b;
|
||||
const body = isGzip ? ungzip(input) : input;
|
||||
const patched = patchWlocBody(body, {
|
||||
latitude: Number(settings.latitude),
|
||||
longitude: Number(settings.longitude),
|
||||
accuracy: Number(settings.accuracy != null ? settings.accuracy : 25),
|
||||
motionSimulationEnabled: settings.motionSimulationEnabled === true
|
||||
});
|
||||
finishBinary(patched.data);
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(`[Location Spoofer] ${error && error.message ? error.message : error}`);
|
||||
finishPassthrough();
|
||||
}
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
export const MODULE_VERSION = "1.0.0";
|
||||
export const PROTOCOL_VERSION = 1;
|
||||
export const CAPABILITIES = [
|
||||
"wifi", "cellTower", "arpc", "marker", "synthetic", "bare", "motionSimulation"
|
||||
];
|
||||
export const STORAGE_KEY = "locationSpoofer.settings.v1";
|
||||
|
||||
export function environment() {
|
||||
if (typeof $task !== "undefined") return "quantumultX";
|
||||
if (typeof $loon !== "undefined") return "loon";
|
||||
if (typeof $rocket !== "undefined") return "shadowrocket";
|
||||
if (typeof Egern !== "undefined") return "egern";
|
||||
if (typeof $environment !== "undefined" && $environment["stash-version"]) return "stash";
|
||||
if (typeof $environment !== "undefined" && $environment["surge-version"]) return "surge";
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
export function readPersistent(key) {
|
||||
const raw = environment() === "quantumultX"
|
||||
? $prefs.valueForKey(key)
|
||||
: $persistentStore.read(key);
|
||||
if (!raw) return null;
|
||||
try { return JSON.parse(raw); } catch { return null; }
|
||||
}
|
||||
|
||||
export function writePersistent(key, value) {
|
||||
const raw = value == null ? "" : JSON.stringify(value);
|
||||
return environment() === "quantumultX"
|
||||
? $prefs.setValueForKey(raw, key)
|
||||
: $persistentStore.write(raw, key);
|
||||
}
|
||||
|
||||
export function responseBytes() {
|
||||
const response = typeof $response === "undefined" ? null : $response;
|
||||
const value = response && response.bodyBytes != null ? response.bodyBytes : response && response.body;
|
||||
if (value instanceof ArrayBuffer) return new Uint8Array(value);
|
||||
if (ArrayBuffer.isView(value)) return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
||||
if (typeof value === "string") {
|
||||
return Uint8Array.from(value, (character) => character.charCodeAt(0) & 0xff);
|
||||
}
|
||||
return new Uint8Array();
|
||||
}
|
||||
|
||||
function cleanHeaders(headers, length) {
|
||||
const out = Object.assign({}, headers || {});
|
||||
for (const name of ["Content-Encoding", "content-encoding", "Transfer-Encoding", "transfer-encoding"]) {
|
||||
delete out[name];
|
||||
}
|
||||
out["Content-Length"] = String(length);
|
||||
return out;
|
||||
}
|
||||
|
||||
export function finishBinary(bytes) {
|
||||
const response = typeof $response === "undefined" ? {} : $response;
|
||||
const headers = cleanHeaders(response.headers, bytes.length);
|
||||
const env = environment();
|
||||
if (env === "quantumultX") {
|
||||
delete headers["Content-Length"];
|
||||
$done({ status: "HTTP/1.1 200 OK", headers, bodyBytes: bytes.buffer });
|
||||
} else if (env === "stash") {
|
||||
$done(Object.assign({}, response, { status: 200, headers, body: bytes }));
|
||||
} else {
|
||||
$done({ response: Object.assign({}, response, { status: 200, headers, body: bytes }) });
|
||||
}
|
||||
}
|
||||
|
||||
export function finishPassthrough() {
|
||||
$done({});
|
||||
}
|
||||
|
||||
export function finishJSON(value) {
|
||||
const response = {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json; charset=utf-8" },
|
||||
body: JSON.stringify(value)
|
||||
};
|
||||
if (environment() === "quantumultX") {
|
||||
$done(Object.assign({}, response, { status: "HTTP/1.1 200 OK" }));
|
||||
} else if (environment() === "stash") {
|
||||
$done(response);
|
||||
} else {
|
||||
$done({ response });
|
||||
}
|
||||
}
|
||||
|
||||
export function queryParameters(url) {
|
||||
const query = url.split("?")[1] || "";
|
||||
const values = {};
|
||||
query.split("&").forEach((item) => {
|
||||
if (!item) return;
|
||||
const separator = item.indexOf("=");
|
||||
const rawKey = separator < 0 ? item : item.slice(0, separator);
|
||||
const rawValue = separator < 0 ? "" : item.slice(separator + 1);
|
||||
let key = rawKey;
|
||||
let value = rawValue;
|
||||
try { key = decodeURIComponent(rawKey.replace(/\+/g, " ")); } catch {}
|
||||
try { value = decodeURIComponent(rawValue.replace(/\+/g, " ")); } catch {}
|
||||
if (!Object.prototype.hasOwnProperty.call(values, key)) values[key] = value;
|
||||
});
|
||||
return values;
|
||||
}
|
||||
|
||||
export function requestPath(url) {
|
||||
const withoutQuery = url.split("?")[0];
|
||||
const scheme = withoutQuery.indexOf("://");
|
||||
if (scheme < 0) return withoutQuery;
|
||||
const path = withoutQuery.indexOf("/", scheme + 3);
|
||||
return path < 0 ? "/" : withoutQuery.slice(path);
|
||||
}
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
import {
|
||||
CAPABILITIES, MODULE_VERSION, PROTOCOL_VERSION, STORAGE_KEY,
|
||||
finishJSON, queryParameters, readPersistent, requestPath, writePersistent
|
||||
} from "./runtime.js";
|
||||
|
||||
const url = typeof $request === "undefined" ? "" : ($request.url || "");
|
||||
const path = requestPath(url);
|
||||
const parameters = queryParameters(url);
|
||||
|
||||
if (path === "/wloc-settings/version") {
|
||||
finishJSON({
|
||||
success: true,
|
||||
moduleVersion: MODULE_VERSION,
|
||||
protocolVersion: PROTOCOL_VERSION,
|
||||
capabilities: CAPABILITIES
|
||||
});
|
||||
} else if (parameters.action === "query") {
|
||||
const settings = readPersistent(STORAGE_KEY);
|
||||
finishJSON(settings && settings.enabled
|
||||
? { success: true, longitude: settings.longitude, latitude: settings.latitude,
|
||||
accuracy: settings.accuracy, motionSimulationEnabled: settings.motionSimulationEnabled === true }
|
||||
: { success: false, error: "无已保存的坐标" });
|
||||
} else if (parameters.action === "clear") {
|
||||
writePersistent(STORAGE_KEY, null);
|
||||
finishJSON({ success: true });
|
||||
} else {
|
||||
const longitude = Number(parameters.lon != null ? parameters.lon : parameters.longitude);
|
||||
const latitude = Number(parameters.lat != null ? parameters.lat : parameters.latitude);
|
||||
const accuracy = Number(parameters.acc != null
|
||||
? parameters.acc
|
||||
: (parameters.accuracy != null ? parameters.accuracy : 25));
|
||||
if (!Number.isFinite(longitude) || !Number.isFinite(latitude)) {
|
||||
finishJSON({ success: false, error: "缺少 lon/lat 参数" });
|
||||
} else {
|
||||
const settings = {
|
||||
enabled: true,
|
||||
longitude,
|
||||
latitude,
|
||||
accuracy,
|
||||
motionSimulationEnabled: parameters.motion === "1"
|
||||
};
|
||||
const success = writePersistent(STORAGE_KEY, settings);
|
||||
finishJSON(success
|
||||
? { success: true, longitude, latitude, accuracy,
|
||||
motionSimulationEnabled: settings.motionSimulationEnabled }
|
||||
: { success: false, error: "保存配置失败" });
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import vm from "node:vm";
|
||||
|
||||
const bundles = [
|
||||
new URL("../dist/v1/wloc.js", import.meta.url),
|
||||
new URL("../dist/v1/wloc-settings.js", import.meta.url)
|
||||
];
|
||||
|
||||
test("generated bundles avoid newer JavaScriptCore runtime requirements", async () => {
|
||||
for (const bundle of bundles) {
|
||||
const source = await readFile(bundle, "utf8");
|
||||
for (const unsupported of [
|
||||
/\bBigInt\b/,
|
||||
/\bglobalThis\b/,
|
||||
/\bURLSearchParams\b/,
|
||||
/\bObject\.fromEntries\b/,
|
||||
/\?\./,
|
||||
/\?\?/
|
||||
]) {
|
||||
assert.equal(unsupported.test(source), false, `${bundle.pathname} contains ${unsupported}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
test("settings bundle runs without modern URL and text globals", async () => {
|
||||
const source = await readFile(bundles[1], "utf8");
|
||||
let result;
|
||||
const storage = new Map();
|
||||
vm.runInNewContext(source, {
|
||||
$rocket: {},
|
||||
$request: {
|
||||
url: "https://gs-loc.apple.com/wloc-settings/save?lon=121.1&lat=31.2&acc=25"
|
||||
},
|
||||
$persistentStore: {
|
||||
read: (key) => storage.get(key) || null,
|
||||
write: (value, key) => {
|
||||
storage.set(key, value);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
$done: (value) => { result = value; },
|
||||
JSON,
|
||||
Number,
|
||||
Object,
|
||||
String,
|
||||
decodeURIComponent
|
||||
});
|
||||
|
||||
assert.equal(JSON.parse(result.response.body).success, true);
|
||||
});
|
||||
-85
@@ -1,85 +0,0 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {
|
||||
MOTION_ACTIVITY_CONFIDENCE, MOTION_ACTIVITY_TYPE, internals, parseFields, patchWlocBody
|
||||
} from "../src/core.js";
|
||||
|
||||
const { concat, writeVarint, writeTag, writeLengthDelimited } = internals;
|
||||
|
||||
function location(withMotion = false) {
|
||||
const fields = [
|
||||
concat(writeTag(1, 0), writeVarint(100)),
|
||||
concat(writeTag(2, 0), writeVarint(200)),
|
||||
concat(writeTag(3, 0), writeVarint(25))
|
||||
];
|
||||
if (withMotion) {
|
||||
fields.push(concat(writeTag(11, 0), writeVarint(7)));
|
||||
fields.push(concat(writeTag(12, 0), writeVarint(88)));
|
||||
}
|
||||
return concat(...fields);
|
||||
}
|
||||
|
||||
function wifiPayload(value = location()) {
|
||||
const device = concat(
|
||||
writeLengthDelimited(1, new TextEncoder().encode("aa:bb:cc:dd:ee:ff")),
|
||||
writeLengthDelimited(2, value)
|
||||
);
|
||||
return writeLengthDelimited(2, device);
|
||||
}
|
||||
|
||||
function frame(payload) {
|
||||
return concat(Uint8Array.from([0, 1, 0, 0, 0, 1, 0, 0]),
|
||||
Uint8Array.from([payload.length >> 8, payload.length & 0xff]), payload);
|
||||
}
|
||||
|
||||
const config = {
|
||||
latitude: 31.230416,
|
||||
longitude: 121.473701,
|
||||
accuracy: 50,
|
||||
motionSimulationEnabled: false
|
||||
};
|
||||
|
||||
test("patches synthetic Wi-Fi response", () => {
|
||||
const result = patchWlocBody(frame(wifiPayload()), config);
|
||||
assert.equal(result.stats.wifi, 1);
|
||||
assert.equal(result.stats.locations, 1);
|
||||
});
|
||||
|
||||
test("preserves motion fields while disabled", () => {
|
||||
const result = patchWlocBody(frame(wifiPayload(location(true))), config);
|
||||
const payload = result.data.slice(10);
|
||||
assert.ok(payload.includes(7));
|
||||
assert.ok(payload.includes(88));
|
||||
});
|
||||
|
||||
test("replaces motion fields while enabled", () => {
|
||||
const result = patchWlocBody(frame(wifiPayload(location(true))), {
|
||||
...config, motionSimulationEnabled: true
|
||||
});
|
||||
const root = parseFields(result.data.slice(10));
|
||||
const device = parseFields(root[0].value);
|
||||
const fields = parseFields(device.find((field) => field.number === 2).value);
|
||||
const motionType = fields.find((field) => field.number === 11);
|
||||
const motionConfidence = fields.find((field) => field.number === 12);
|
||||
assert.deepEqual(motionType.value, writeVarint(MOTION_ACTIVITY_TYPE));
|
||||
assert.deepEqual(motionConfidence.value, writeVarint(MOTION_ACTIVITY_CONFIDENCE));
|
||||
});
|
||||
|
||||
test("patches CellTower fields 22 and 24", () => {
|
||||
for (const number of [22, 24]) {
|
||||
const cell = writeLengthDelimited(5, location());
|
||||
const result = patchWlocBody(frame(writeLengthDelimited(number, cell)), config);
|
||||
assert.equal(result.stats.cell, 1);
|
||||
}
|
||||
});
|
||||
|
||||
test("encodes signed int64 coordinates without BigInt", () => {
|
||||
assert.deepEqual(
|
||||
Array.from(writeVarint(-18_000_000_000)),
|
||||
[128, 152, 247, 248, 188, 255, 255, 255, 255, 1]
|
||||
);
|
||||
assert.deepEqual(
|
||||
Array.from(writeVarint(18_000_000_000)),
|
||||
[128, 232, 136, 135, 67]
|
||||
);
|
||||
});
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
## 已发布
|
||||
|
||||
- [v1.0.6](https://github.com/xweiba/location-spoofer/releases/tag/v1.0.6) — 2026-09-01
|
||||
- [v1.0.5](https://github.com/xweiba/location-spoofer/releases/tag/v1.0.5) — 2026-08-10
|
||||
- [v1.0.4](https://github.com/xweiba/location-spoofer/releases/tag/v1.0.4) — 2026-08-09
|
||||
- [v1.0.3](https://github.com/xweiba/location-spoofer/releases/tag/v1.0.3) — 2026-08-09
|
||||
|
||||
+23
-41
@@ -1,20 +1,20 @@
|
||||
# Third-party proxy modules
|
||||
|
||||
The files under `Resources/ThirdPartyProxyModules/` are project-owned module
|
||||
definitions used by the App's default domestic-mirror subscription path. Their
|
||||
executable scripts are built from `ThirdParty/WlocScripts/src/` and checked in
|
||||
under the versioned `ThirdParty/WlocScripts/dist/v1/` directory.
|
||||
Third-party proxy mode (Surge / Quantumult X / Loon / Shadowrocket / Stash /
|
||||
Egern) now relies entirely on the upstream
|
||||
[Yu9191/wloc](https://github.com/Yu9191/wloc) modules. The App no longer
|
||||
maintains or ships project-owned module/script copies, so it never drifts
|
||||
from the upstream protocol.
|
||||
|
||||
The direct GitHub Raw variants are stored under
|
||||
`ThirdParty/WlocScripts/modules/direct/`. The Settings switch selects which
|
||||
module URL the App copies:
|
||||
## Subscription addresses
|
||||
|
||||
- enabled by default: `gh-proxy.org` in front of GitHub Raw;
|
||||
- disabled: GitHub Raw directly.
|
||||
The App builds each client's module subscription URL directly from the
|
||||
upstream repository:
|
||||
|
||||
The App appends the module version as a query parameter, such as `?v=1.0.0`.
|
||||
Increment this value whenever an existing module path changes so proxy clients
|
||||
do not reuse a previously cached subscription body.
|
||||
- default mirror (gh-proxy):
|
||||
`https://gh-proxy.org/https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/<file>`
|
||||
- direct:
|
||||
`https://raw.githubusercontent.com/Yu9191/wloc/refs/heads/main/modules/<file>`
|
||||
|
||||
| Module file | Client |
|
||||
|---|---|
|
||||
@@ -24,35 +24,17 @@ do not reuse a previously cached subscription body.
|
||||
| `wloc.lpx` | Loon |
|
||||
| `wloc.stoverride` | Stash |
|
||||
|
||||
Egern reuses the Surge module. Stash imports `.stoverride` directly.
|
||||
No `?v=` cache-bust is appended: the URL points at upstream's latest content,
|
||||
and re-importing the subscription in the proxy client re-fetches it.
|
||||
|
||||
Both script entry points are owned by this repository:
|
||||
## Script protocol
|
||||
|
||||
- `wloc.js` patches Apple WLOC response bodies;
|
||||
- `wloc-settings.js` implements `/wloc-settings/save` and
|
||||
`/wloc-settings/version`.
|
||||
The upstream `wloc.js` patches Apple WLOC responses and reads coordinates from
|
||||
the `wloc_settings` persistent key or the module `argument` config. The
|
||||
upstream `wloc-settings.js` implements `wloc-settings/save` (query/clear/save)
|
||||
using `lon`/`lat`/`acc`/`randomRadius` parameters.
|
||||
|
||||
The generated scripts target ES2017 and avoid hard dependencies on `BigInt`,
|
||||
optional chaining, nullish coalescing, `globalThis`, `URLSearchParams`, and
|
||||
`Object.fromEntries`. This keeps them usable by older proxy-client releases
|
||||
that still implement the established module syntax, binary response body,
|
||||
`$done`, and persistent-storage APIs.
|
||||
|
||||
Already-installed legacy modules that point to another repository are not
|
||||
silently migrated because their remote script URL is outside this project's
|
||||
control. Those users must re-import the project-owned module before using the
|
||||
versioned protocol and motion setting.
|
||||
|
||||
Current bundled module SHA-256 values:
|
||||
|
||||
```text
|
||||
263f3eae0ec4ef19d03eefa58f28e6545cccbc6a2d32c5e1d3493ba207ca7605 wloc.conf
|
||||
c0755a9edb2a1686190d12d156e9aa53693e15721efc4a29f9a06c2bf3115a5f wloc.lpx
|
||||
06a426e4f37828d18b80abea04a8ade4fa7f93817cb1e37928c52da3e46f693a wloc.module
|
||||
f6b9fc51c4d3c4fca837ff896dbe544f99604d9646f05841bad82bfdfdf5c4fa wloc.sgmodule
|
||||
100e569e6ca3183f7da15fbb38ddb5cd91178488c0d9774acabc2721fa85a58c wloc.stoverride
|
||||
```
|
||||
|
||||
The project acknowledges [Yu9191/wloc](https://github.com/Yu9191/wloc) as a
|
||||
reference for earlier WLOC implementation ideas. That acknowledgement is not
|
||||
an executable dependency or subscription source.
|
||||
The App's third-party save sends `lon`/`lat`/`acc`, matching the upstream
|
||||
script. Motion-state simulation (fields 11/12) is **not** implemented by the
|
||||
upstream scripts and is unavailable in third-party mode; it remains available
|
||||
in APP mode (built-in proxy).
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# v1.0.6
|
||||
|
||||
发布日期:2026-09-01
|
||||
|
||||
## 主要更新
|
||||
|
||||
- 第三方代理模式完全改用上游 Yu9191/wloc 的模块与脚本,订阅地址直接指向上游(支持 gh-proxy 国内镜像),项目不再维护自有模块/脚本副本,避免再因版本漂移失效。
|
||||
- 扩展 Apple 定位域名拦截:新增 `gsp-ssl.ls.apple.com`、`bluedot.is.autonavi.com`(国内设备真实定位域名),内置代理同步覆盖。
|
||||
- 第三方模式新增「随机扰动」开关:同步坐标时给目标点添加随机偏移(默认 50 米),防止位置固定在同一点。
|
||||
- 运动状态模拟改为仅 APP 模式可用(上游脚本不支持第三方运动模拟)。
|
||||
- 移除脚本版本检测:不再请求 `/wloc-settings/version`,第三方模式基础坐标同步不再受版本协议影响。
|
||||
- 新增 iOS 27 beta 6 起系统禁止对 `gs-loc.apple.com` 进行 MITM 拦截的警告提示(App 引导与 README 同步)。
|
||||
|
||||
## 提交变更总结
|
||||
|
||||
- `b530d52` feat: drop script version detection; split motion vs perturbation by mode
|
||||
- `135e26e` feat: point third-party mode at upstream Yu9191 modules
|
||||
- `d35d5c7` feat: vendor upstream modules verbatim, mirror via gh-proxy
|
||||
- `cce2aef` feat: wire randomRadius perturbation argument into all modules
|
||||
- `9cea683` fix: point third-party modules at upstream wloc scripts
|
||||
- `fb0ca96` fix: sync third-party wloc scripts with upstream
|
||||
- `a666f17` fix: intercept gsp-ssl.ls.apple.com and bluedot wloc endpoints
|
||||
|
||||
## 自签安装
|
||||
|
||||
- Release 附件为未签名 IPA,安装前需要自行签名。
|
||||
- 可使用免费 Apple ID 和 Impactor 完成签名安装,无需付费开发者账号。
|
||||
- 签名时请保留 Bundle ID `com.paopaolabs.location-spoofer`、App Group `group.com.paopaolabs.location-spoofer` 及原有 entitlements。
|
||||
- 免费 Apple ID 签名通常只有 7 天有效期,到期后需要重新签名安装。
|
||||
|
||||
<!-- commit-range: v1.0.5..v1.0.6 -->
|
||||
+2
-2
@@ -8,8 +8,8 @@ options:
|
||||
settings:
|
||||
base:
|
||||
SWIFT_VERSION: "5.9"
|
||||
MARKETING_VERSION: "1.0.5"
|
||||
CURRENT_PROJECT_VERSION: "6"
|
||||
MARKETING_VERSION: "1.0.6"
|
||||
CURRENT_PROJECT_VERSION: "7"
|
||||
CODE_SIGN_STYLE: Manual
|
||||
CODE_SIGNING_ALLOWED: "NO"
|
||||
CODE_SIGNING_REQUIRED: "NO"
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"latestVersion": "1.0.5",
|
||||
"latestVersion": "1.0.6",
|
||||
"minimumSupportedVersion": "1.0.0",
|
||||
"communityPromptClients": ["surge", "quantumultX", "loon", "stash", "egern"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user