allow local dev using local music tools server

This commit is contained in:
andy 2022-04-21 13:59:29 +01:00
parent 6cdafc4535
commit 137cf17c46
4 changed files with 125 additions and 3 deletions

View File

@ -535,7 +535,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
@ -590,7 +590,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E9EA690623F9A5430012C3E8"
BuildableName = "Music Tools.app"
BlueprintName = "Music Tools"
ReferencedContainer = "container:Music Tools.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E9EA691C23F9A54B0012C3E8"
BuildableName = "Music ToolsTests.xctest"
BlueprintName = "Music ToolsTests"
ReferencedContainer = "container:Music Tools.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E9EA692723F9A54B0012C3E8"
BuildableName = "Music ToolsUITests.xctest"
BlueprintName = "Music ToolsUITests"
ReferencedContainer = "container:Music Tools.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E9EA690623F9A5430012C3E8"
BuildableName = "Music Tools.app"
BlueprintName = "Music Tools"
ReferencedContainer = "container:Music Tools.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "MTOOLS_SERVER"
value = "http://127.0.0.1:5000/"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E9EA690623F9A5430012C3E8"
BuildableName = "Music Tools.app"
BlueprintName = "Music Tools"
ReferencedContainer = "container:Music Tools.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -56,7 +56,17 @@ struct RequestBuilder {
struct ApiRequestDefaults {
static let authMethod: AuthMethod = .basic
static let domain: String = "https://music.sarsoo.xyz/"
static var domain: String { get {
let default_url = "https://music.sarsoo.xyz/"
switch getenv("MTOOLS_SERVER") {
case .none:
return default_url
case .some(let url):
return String(utf8String: url) ?? default_url
}
} }
}
protocol ApiRequest {

View File

@ -7,6 +7,7 @@
//
import SwiftUI
import KeychainAccess
struct LoginScreen: View {
@ -29,6 +30,12 @@ struct LoginScreen: View {
SecureField("Password", text: $password)
HStack {
Button(action: {
let keychain = Keychain(service: "xyz.sarsoo.music.login")
keychain["username"] = username
keychain["password"] = password
self.liveUser.loggedIn = true
}) {
Text("Log In")