Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Manager/Sources/RDMUICManager/BuildController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class BuildController {
"startupLocationLon=\(device.startupLocationLon)", "encounterMaxWait=\(device.encounterMaxWait)",
"encounterDelay=\(device.encounterDelay)", "fastIV=\(device.fastIV)", "ultraIV=\(device.ultraIV)",
"deployEggs=\(device.deployEggs)", "token=\(device.token)", "ultraQuests=\(device.ultraQuests)",
"attachScreenshots=\(device.attachScreenshots)"
"attachScreenshots=\(device.attachScreenshots)", "appKey=\(device.appKey)"
)

var contains = true
Expand Down
17 changes: 17 additions & 0 deletions Manager/Sources/RDMUICManager/CLI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class CLI {
Ultra Quests: \(device.ultraQuests.toBool())
Enabled: \(device.enabled.toBool())
AttachScreenshots: \(device.attachScreenshots.toBool())
App Key: \(device.appKey)
"""

print(row + "\n")
Expand Down Expand Up @@ -317,6 +318,11 @@ class CLI {
defaultDevice.attachScreenshots = attachScreenshots!.toInt()
}

let appKey = askInput("Default App Key (empty = \(defaultDevice.appKey))")
if appKey != "" {
defaultDevice.appKey = appKey
}

do {
try defaultDevice.save()
clear()
Expand Down Expand Up @@ -473,6 +479,11 @@ class CLI {
attachScreenshots = defaultDevice.attachScreenshots
}

var appKey = askInput("App Key (empty = \(defaultDevice.appKey))")
if appKey == "" {
appKey = defaultDevice.appKey
}

device.uuid = uuid
device.name = name
device.backendURL = backendURL
Expand Down Expand Up @@ -502,6 +513,7 @@ class CLI {
device.ultraQuests = ultraQuests!
device.enabled = enabled!
device.attachScreenshots = attachScreenshots!
device.appKey = appKey

do {
try device.create()
Expand Down Expand Up @@ -674,6 +686,11 @@ class CLI {
device.attachScreenshots = attachScreenshots!.toInt()
}

let appKey = askInput("App Key (empty = \(device.appKey))")
if appKey != "" {
device.appKey = appKey
}

do {
try device.save()
clear()
Expand Down
6 changes: 5 additions & 1 deletion Manager/Sources/RDMUICManager/Device.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class Device: SQLiteStORM, Equatable, Hashable {
var ultraQuests: Int
var enabled: Int
var attachScreenshots: Int
var appKey: String

override init() {
self.uuid = ""
Expand Down Expand Up @@ -84,6 +85,7 @@ class Device: SQLiteStORM, Equatable, Hashable {
self.ultraQuests = 0
self.enabled = 1
self.attachScreenshots = 0
self.appKey = ""
super.init()
}

Expand All @@ -92,7 +94,7 @@ class Device: SQLiteStORM, Equatable, Hashable {
targetMaxDistance: Double, itemFullCount: Int, questFullCount: Int, itemsPerStop: Int, minDelayLogout: Double,
maxNoQuestCount: Int, maxFailedCount: Int, maxEmptyGMO: Int, startupLocationLat: Double,
startupLocationLon: Double, encounterMaxWait: Int, encounterDelay: Double, fastIV: Int, ultraIV: Int,
deployEggs: Int, token: String, ultraQuests: Int, enabled: Int, attachScreenshots: Int) {
deployEggs: Int, token: String, ultraQuests: Int, enabled: Int, attachScreenshots: Int, appKey: String) {
self.uuid = uuid
self.name = name
self.backendURL = backendURL
Expand Down Expand Up @@ -122,6 +124,7 @@ class Device: SQLiteStORM, Equatable, Hashable {
self.ultraQuests = ultraQuests
self.enabled = enabled
self.attachScreenshots = attachScreenshots
self.appKey = appKey
super.init()
}

Expand Down Expand Up @@ -159,6 +162,7 @@ class Device: SQLiteStORM, Equatable, Hashable {
ultraQuests = this.data["ultraQuests"] as? Int ?? 0
enabled = this.data["enabled"] as? Int ?? 1
attachScreenshots = this.data["attachScreenshots"] as? Int ?? 0
appKey = this.data["appKey"] as? String ?? ""
}

static func getAll() -> [Device] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@
value = "$(attachScreenshots)"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "appKey"
value = "$(appKey)"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
Expand Down
2 changes: 2 additions & 0 deletions RealDeviceMap-UIControl/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class Config {
var ultraQuests: Bool
var enabled: Bool
var attachScreenshots: Bool
var appKey: String

init() {

Expand Down Expand Up @@ -74,6 +75,7 @@ class Config {
ultraQuests = enviroment["ultraQuests"]?.toBool() ?? false
enabled = enviroment["enabled"]?.toBool() ?? true
attachScreenshots = enviroment["attachScreenshots"]?.toBool() ?? false
appKey = enviroment["appKey"] ?? ""
}

}
19 changes: 19 additions & 0 deletions RealDeviceMap-UIControl/RealDeviceMap_UIControlUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,23 @@ class RealDeviceMap_UIControlUITests: XCTestCase {
return HTTPResponse(.ok)
}

func handleConfigRequest(request: HTTPRequest) -> HTTPResponse {
let responseData: [String: Any] = [
"key": self.config.appKey ?? "",
"loc": "", // optional
"endpoints": [""] // optional
]
do {
let jsonData = try JSONSerialization.data(withJSONObject: responseData, options: .prettyPrinted)
let jsonString = String(data: jsonData, encoding: .utf8) ?? ""
let response = HTTPResponse(content: jsonString)
response.headers = ["Content-Type": "application/json"]
return response
} catch {
return HTTPResponse(.internalServerError)
}
}

func part8Main() {

if shouldExit || ((username == nil || isLoggedIn == false) && config.enableAccountManager) {
Expand Down Expand Up @@ -1969,6 +1986,8 @@ class RealDeviceMap_UIControlUITests: XCTestCase {
self.server.route(.post, "loc", self.handleLocRequest)
self.server.route(.get, "data", self.handleDataRequest)
self.server.route(.post, "data", self.handleDataRequest)
self.server.route(.get, "config", self.handleConfigRequest)
self.server.route(.post, "config", self.handleConfigRequest)

self.lock.lock()
self.currentLocation = self.config.startupLocation
Expand Down