From af6456e186c759c390d4afd205c1ad600fc7b5c4 Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Wed, 27 Sep 2023 15:52:23 -0300 Subject: [PATCH 1/8] fixes some linux issues --- .gitignore | 1 + telegram/Dockerfile | 22 ++++++++++++ .../LandinhoBot/SwiftBot/SwiftyBot.swift | 34 ++++++++++++++++--- 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 telegram/Dockerfile diff --git a/.gitignore b/.gitignore index 3b29812..8bfa2f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +*/.build /.build /Packages /*.xcodeproj diff --git a/telegram/Dockerfile b/telegram/Dockerfile new file mode 100644 index 0000000..8a60493 --- /dev/null +++ b/telegram/Dockerfile @@ -0,0 +1,22 @@ +# Use an official Swift runtime as a parent image +FROM swift:5.9-jammy + +# Set the working directory to /app +WORKDIR /app + +# Copy the Package.swift and all source files into the container +COPY ./Package.* ./ +RUN swift package resolve --skip-update \ + "$([ -f ./Package.resolved ] && echo "--force-resolved-versions" || true)" + +COPY . . + +# Build the Swift package +RUN swift build -c release --static-swift-stdlib \ + # Workaround for https://github.com/apple/swift/pull/68669 + # This can be removed as soon as 5.9.1 is released, but is harmless if left in. + -Xlinker -u -Xlinker _swift_backtrace_isThunkFunction + + +# Specify the command to run your Swift package +CMD ["./.build/debug/LandinhoBot"] \ No newline at end of file diff --git a/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift b/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift index 0a80ea3..442ff6f 100644 --- a/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift +++ b/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift @@ -1,4 +1,7 @@ import Foundation +#if os(Linux) +import FoundationNetworking +#endif import TelegramBotSDK open class SwiftyBot { @@ -150,7 +153,7 @@ final class DefaultVroomBot: SwiftyBot { Task { try await self.handleNextRace(update: update, args: args) } - }) + }) ] } @@ -163,10 +166,10 @@ final class DefaultVroomBot: SwiftyBot { return } - let data = try await URLSession.shared.data(from: url) + let data = try await URLSession.shared.data(url: url) let decoder = JSONDecoder() decoder.dateDecodingStrategy = .iso8601 - let response = try decoder.decode(NextRaceResponse.self, from: data.0) + let response = try decoder.decode(NextRaceResponse.self, from: data) guard let formattedRace = formatRace(response: response) else { return } bot.reply(update, text: formattedRace) } @@ -199,6 +202,29 @@ final class DefaultVroomBot: SwiftyBot { } func formatEvent(_ event: RaceEvent) -> String { - "\(event.date.formatted()) \(event.title)" + "\(Self.formatter.string(from: event.date)) \(event.title)" + } + + static let formatter = { + let f = DateFormatter() + return f + }() +} + +extension URLSession { + func data(url: URL) async throws -> Data { + try await withCheckedThrowingContinuation { continuation in + let request = URLRequest(url: url) + self.dataTask(with: request) { data, _, error in + guard let data else { + if let error { + continuation.resume(throwing: error) + } + return + } + + continuation.resume(returning: data) + }.resume() + } } } From cd2f8e9ffdfc8db2de3bd25a632974b3d50bbf0f Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Wed, 27 Sep 2023 23:48:15 -0300 Subject: [PATCH 2/8] changes a couple of things --- telegram/Dockerfile | 8 ++----- .../Sources/LandinhoBot/LandinhoBot.swift | 13 ++++++++---- .../LandinhoBot/SwiftBot/SwiftyBot.swift | 21 +++++++++++++------ 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/telegram/Dockerfile b/telegram/Dockerfile index 8a60493..2a302e8 100644 --- a/telegram/Dockerfile +++ b/telegram/Dockerfile @@ -12,11 +12,7 @@ RUN swift package resolve --skip-update \ COPY . . # Build the Swift package -RUN swift build -c release --static-swift-stdlib \ - # Workaround for https://github.com/apple/swift/pull/68669 - # This can be removed as soon as 5.9.1 is released, but is harmless if left in. - -Xlinker -u -Xlinker _swift_backtrace_isThunkFunction - +RUN swift build # Specify the command to run your Swift package -CMD ["./.build/debug/LandinhoBot"] \ No newline at end of file +CMD ["./.build/debug/LandinhoBot"] diff --git a/telegram/Sources/LandinhoBot/LandinhoBot.swift b/telegram/Sources/LandinhoBot/LandinhoBot.swift index b73538e..5786dbc 100644 --- a/telegram/Sources/LandinhoBot/LandinhoBot.swift +++ b/telegram/Sources/LandinhoBot/LandinhoBot.swift @@ -1,6 +1,11 @@ @main -public struct LandinhoBot { - public static func main() { - DefaultVroomBot() - } +public class LandinhoBot { + init(bot: DefaultVroomBot) { + self.bot = bot + } + let bot: DefaultVroomBot + + public static func main() { + _ = LandinhoBot(bot: .init()) + } } diff --git a/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift b/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift index 442ff6f..a210516 100644 --- a/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift +++ b/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift @@ -158,20 +158,28 @@ final class DefaultVroomBot: SwiftyBot { } func handleNextRace(update: Update, args: [String]) async throws { - var categoryTag = args.dropFirst().first ?? "" + let categoryTag = args.dropFirst().first ?? "" guard let url = self.buildURL(path: "next-race", args: ["argument": categoryTag]) else { + bot.reply(update, text: "Internal error") return } let data = try await URLSession.shared.data(url: url) let decoder = JSONDecoder() decoder.dateDecodingStrategy = .iso8601 - let response = try decoder.decode(NextRaceResponse.self, from: data) - guard let formattedRace = formatRace(response: response) else { return } - bot.reply(update, text: formattedRace) + do { + let response = try decoder.decode(NextRaceResponse.self, from: data) + guard let formattedRace = formatRace(response: response) else { + bot.reply(update, text: "Couldn't find next race") + return + } + bot.reply(update, text: formattedRace) + } catch (let error) { + bot.reply(update, text: "\(error)") + } } func buildURL(path: String, args: [String: String]) -> URL? { @@ -215,7 +223,7 @@ extension URLSession { func data(url: URL) async throws -> Data { try await withCheckedThrowingContinuation { continuation in let request = URLRequest(url: url) - self.dataTask(with: request) { data, _, error in + let task = dataTask(with: request) { data, _, error in guard let data else { if let error { continuation.resume(throwing: error) @@ -224,7 +232,8 @@ extension URLSession { } continuation.resume(returning: data) - }.resume() + } + task.resume() } } } From a9dec6b5a8064ede7603721054933180bac363ab Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Thu, 28 Sep 2023 00:05:30 -0300 Subject: [PATCH 3/8] first attempt at deginnifying --- backend/Package.resolved | 27 ----------------------- backend/Package.swift | 5 ----- backend/Sources/App/configure.swift | 3 +++ backend/Sources/App/entrypoint.swift | 2 -- backend/Sources/App/pages/category.swift | 1 - backend/Sources/App/pages/next-race.swift | 2 +- backend/Sources/App/pages/race.swift | 8 ++++++- 7 files changed, 11 insertions(+), 37 deletions(-) diff --git a/backend/Package.resolved b/backend/Package.resolved index 6c49fbc..983f8f3 100644 --- a/backend/Package.resolved +++ b/backend/Package.resolved @@ -54,15 +54,6 @@ "version" : "2.8.0" } }, - { - "identity" : "ginny", - "kind" : "remoteSourceControl", - "location" : "https://github.com/gonzalonunez/ginny.git", - "state" : { - "revision" : "4ab1e7d43d3ef4d161cccdad6145fe90f11c666c", - "version" : "0.1.1" - } - }, { "identity" : "multipart-kit", "kind" : "remoteSourceControl", @@ -117,15 +108,6 @@ "version" : "1.0.0" } }, - { - "identity" : "swift-argument-parser", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-argument-parser.git", - "state" : { - "revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531", - "version" : "1.2.3" - } - }, { "identity" : "swift-atomics", "kind" : "remoteSourceControl", @@ -225,15 +207,6 @@ "version" : "1.0.2" } }, - { - "identity" : "swift-syntax", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-syntax.git", - "state" : { - "revision" : "edd2d0cdb988ac45e2515e0dd0624e4a6de54a94", - "version" : "0.50800.0-SNAPSHOT-2022-12-29-a" - } - }, { "identity" : "vapor", "kind" : "remoteSourceControl", diff --git a/backend/Package.swift b/backend/Package.swift index 73f9ce4..e3b605c 100644 --- a/backend/Package.swift +++ b/backend/Package.swift @@ -13,7 +13,6 @@ let package = Package( .package(url: "https://github.com/vapor/fluent.git", from: "4.8.0"), // 🐘 Fluent driver for Postgres. .package(url: "https://github.com/vapor/fluent-postgres-driver.git", from: "2.7.2"), - .package(url: "https://github.com/gonzalonunez/ginny.git", from: "0.1.1"), ], targets: [ .executableTarget( @@ -22,10 +21,6 @@ let package = Package( .product(name: "Fluent", package: "fluent"), .product(name: "FluentPostgresDriver", package: "fluent-postgres-driver"), .product(name: "Vapor", package: "vapor"), - .product(name: "Ginny", package: "ginny"), - ], - plugins: [ - .plugin(name: "GinnyPlugin", package: "ginny") ] ), .testTarget(name: "AppTests", dependencies: [ diff --git a/backend/Sources/App/configure.swift b/backend/Sources/App/configure.swift index 6e15897..775d86b 100644 --- a/backend/Sources/App/configure.swift +++ b/backend/Sources/App/configure.swift @@ -19,5 +19,8 @@ public func configure(_ app: Application) async throws { app.migrations.add(v0_1Migration()) + let nr = NextRaceHandler() + app.routes.get("next-race", use: nr.handle(req:)) + try await app.autoMigrate() } diff --git a/backend/Sources/App/entrypoint.swift b/backend/Sources/App/entrypoint.swift index 3d15081..14cdb1c 100644 --- a/backend/Sources/App/entrypoint.swift +++ b/backend/Sources/App/entrypoint.swift @@ -1,7 +1,6 @@ import Vapor import Dispatch import Logging -import Ginny /// This extension is temporary and can be removed once Vapor gets this support. private extension Vapor.Application { @@ -29,7 +28,6 @@ enum Entrypoint { let app = Application(env) defer { app.shutdown() } - app.registerRoutes() do { try await configure(app) diff --git a/backend/Sources/App/pages/category.swift b/backend/Sources/App/pages/category.swift index 697dc98..917607f 100644 --- a/backend/Sources/App/pages/category.swift +++ b/backend/Sources/App/pages/category.swift @@ -7,7 +7,6 @@ import Vapor import Foundation -import Ginny struct UploadCategoryHandler: AsyncRequestHandler { var method: HTTPMethod { .POST } diff --git a/backend/Sources/App/pages/next-race.swift b/backend/Sources/App/pages/next-race.swift index 99f21f7..cfd1d21 100644 --- a/backend/Sources/App/pages/next-race.swift +++ b/backend/Sources/App/pages/next-race.swift @@ -7,11 +7,11 @@ import Foundation import Vapor -import Ginny struct NextRaceHandler: AsyncRequestHandler { var method: HTTPMethod { .GET } + @Sendable func handle(req: Request) async throws -> some AsyncResponseEncodable { let args = try req.query.decode(NextRaceRequest.self) let currentDate = Date() diff --git a/backend/Sources/App/pages/race.swift b/backend/Sources/App/pages/race.swift index 9d314e2..002ed62 100644 --- a/backend/Sources/App/pages/race.swift +++ b/backend/Sources/App/pages/race.swift @@ -7,7 +7,13 @@ import Vapor import Foundation -import Ginny + +public protocol AsyncRequestHandler { + init() + associatedtype Response: AsyncResponseEncodable + var method: HTTPMethod { get } + func handle(req: Request) async throws -> Response +} struct UploadRaceHandler: AsyncRequestHandler { var method: HTTPMethod { .POST } From c874d725d70ea665007047c52e8b7d811b998f9a Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Thu, 28 Sep 2023 08:16:59 -0300 Subject: [PATCH 4/8] registers all routes --- backend/Sources/App/AsyncRequestHandler.swift | 36 +++++++++++++++++++ backend/Sources/App/configure.swift | 7 ++-- backend/Sources/App/pages/category.swift | 1 + backend/Sources/App/pages/next-race.swift | 3 +- backend/Sources/App/pages/race.swift | 8 +---- 5 files changed, 45 insertions(+), 10 deletions(-) create mode 100644 backend/Sources/App/AsyncRequestHandler.swift diff --git a/backend/Sources/App/AsyncRequestHandler.swift b/backend/Sources/App/AsyncRequestHandler.swift new file mode 100644 index 0000000..4bd8624 --- /dev/null +++ b/backend/Sources/App/AsyncRequestHandler.swift @@ -0,0 +1,36 @@ +// +// AsyncRequestHandler.swift +// +// +// Created by Mauricio Cardozo on 28/09/23. +// + +import Foundation +import Vapor + +// This file is part of the de-ginnyfication of the repo - We should investigate the memory issues and bring ginny back + +public protocol AsyncRequestHandler { + init() + associatedtype Response: AsyncResponseEncodable + var method: HTTPMethod { get } + var path: String { get } + func handle(req: Request) async throws -> Response +} + +extension AsyncRequestHandler { + public func register(in app: Application) { + app + .on(method, path.pathComponents) { [handle] req async throws in + return try await handle(req) + } + } +} + +extension Array where Element == any AsyncRequestHandler { + func register(in app: Application) { + self.forEach { + $0.register(in: app) + } + } +} diff --git a/backend/Sources/App/configure.swift b/backend/Sources/App/configure.swift index 775d86b..e9f7b6b 100644 --- a/backend/Sources/App/configure.swift +++ b/backend/Sources/App/configure.swift @@ -19,8 +19,11 @@ public func configure(_ app: Application) async throws { app.migrations.add(v0_1Migration()) - let nr = NextRaceHandler() - app.routes.get("next-race", use: nr.handle(req:)) + [ + UploadCategoryHandler(), + NextRaceHandler(), + UploadRaceHandler() + ].register(in: app) try await app.autoMigrate() } diff --git a/backend/Sources/App/pages/category.swift b/backend/Sources/App/pages/category.swift index 917607f..db236a0 100644 --- a/backend/Sources/App/pages/category.swift +++ b/backend/Sources/App/pages/category.swift @@ -10,6 +10,7 @@ import Foundation struct UploadCategoryHandler: AsyncRequestHandler { var method: HTTPMethod { .POST } + var path: String { "category" } func handle(req: Request) async throws -> some AsyncResponseEncodable { let request = try req.content.decode(UploadCategoryRequest.self) diff --git a/backend/Sources/App/pages/next-race.swift b/backend/Sources/App/pages/next-race.swift index cfd1d21..d00a7dd 100644 --- a/backend/Sources/App/pages/next-race.swift +++ b/backend/Sources/App/pages/next-race.swift @@ -10,7 +10,8 @@ import Vapor struct NextRaceHandler: AsyncRequestHandler { var method: HTTPMethod { .GET } - + var path: String { "next-race" } + @Sendable func handle(req: Request) async throws -> some AsyncResponseEncodable { let args = try req.query.decode(NextRaceRequest.self) diff --git a/backend/Sources/App/pages/race.swift b/backend/Sources/App/pages/race.swift index 002ed62..d93680f 100644 --- a/backend/Sources/App/pages/race.swift +++ b/backend/Sources/App/pages/race.swift @@ -8,15 +8,9 @@ import Vapor import Foundation -public protocol AsyncRequestHandler { - init() - associatedtype Response: AsyncResponseEncodable - var method: HTTPMethod { get } - func handle(req: Request) async throws -> Response -} - struct UploadRaceHandler: AsyncRequestHandler { var method: HTTPMethod { .POST } + var path: String { "race" } func handle(req: Request) async throws -> some AsyncResponseEncodable { let request = try req.content.decode(UploadRaceRequest.self) From 7be8158ab1163eafd761aed032303f46267beb35 Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Thu, 28 Sep 2023 08:42:59 -0300 Subject: [PATCH 5/8] removes argument requirement from next-race, logs registration --- backend/Sources/App/AsyncRequestHandler.swift | 1 + backend/Sources/App/pages/next-race.swift | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/backend/Sources/App/AsyncRequestHandler.swift b/backend/Sources/App/AsyncRequestHandler.swift index 4bd8624..6e882d7 100644 --- a/backend/Sources/App/AsyncRequestHandler.swift +++ b/backend/Sources/App/AsyncRequestHandler.swift @@ -20,6 +20,7 @@ public protocol AsyncRequestHandler { extension AsyncRequestHandler { public func register(in app: Application) { + app.logger.info("registering \(path.pathComponents) as \(method.string)") app .on(method, path.pathComponents) { [handle] req async throws in return try await handle(req) diff --git a/backend/Sources/App/pages/next-race.swift b/backend/Sources/App/pages/next-race.swift index d00a7dd..572a2f6 100644 --- a/backend/Sources/App/pages/next-race.swift +++ b/backend/Sources/App/pages/next-race.swift @@ -14,7 +14,13 @@ struct NextRaceHandler: AsyncRequestHandler { @Sendable func handle(req: Request) async throws -> some AsyncResponseEncodable { - let args = try req.query.decode(NextRaceRequest.self) + var args: String + do { + args = try req.query.decode(NextRaceRequest.self).argument + } catch { + args = "" + } + let currentDate = Date() let query = Race @@ -25,8 +31,8 @@ struct NextRaceHandler: AsyncRequestHandler { .with(\.$events) .with(\.$category) - if !args.argument.isEmpty { - query.filter(Category.self, \.$tag, .equal, args.argument) + if !args.isEmpty { + query.filter(Category.self, \.$tag, .equal, args) } let nextRace = try await query.first() From a0f5af637fdbdbaa43938d88bb4adfe1cb3f2ee8 Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Thu, 28 Sep 2023 10:30:46 -0300 Subject: [PATCH 6/8] fixes date formatting and pushing to quakehost --- .../Sources/APIRequester/APIRequester.swift | 8 ++- .../Sources/AdminLib/UploadRace.swift | 57 ++++++++++++++++++- .../SuperLandoAdmin.xcodeproj/project.pbxproj | 4 ++ SuperLandoAdmin/SuperLandoAdmin/Info.plist | 19 +++++++ .../LandinhoBot/SwiftBot/SwiftyBot.swift | 3 +- 5 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 SuperLandoAdmin/SuperLandoAdmin/Info.plist diff --git a/SuperLandoAdmin/AdminLib/Sources/APIRequester/APIRequester.swift b/SuperLandoAdmin/AdminLib/Sources/APIRequester/APIRequester.swift index 6d3eb8f..7fb5d25 100644 --- a/SuperLandoAdmin/AdminLib/Sources/APIRequester/APIRequester.swift +++ b/SuperLandoAdmin/AdminLib/Sources/APIRequester/APIRequester.swift @@ -39,7 +39,8 @@ final class APIRequester: APIRequesting { func makeURL(path: String, queryItems: [URLQueryItem]?) throws -> URL? { #if DEBUG - let host: String = "localhost" + // let host: String = "localhost" + let host: String = "quake.host" #else let host: String = "myones-backend.onrender.com" #endif @@ -51,9 +52,10 @@ final class APIRequester: APIRequesting { // let host: String = try Configuration.value(for: "BASE_URL", in: .main) var components = URLComponents() - components.scheme = isLocalhost ? "http" : "https" + components.scheme = isLocalhost ? "http" : "http" components.host = host - if isLocalhost { components.port = 8080 } +// if isLocalhost { components.port = 8080 } + components.port = 8080 components.path = "/\(path)" components.queryItems = queryItems return components.url diff --git a/SuperLandoAdmin/AdminLib/Sources/AdminLib/UploadRace.swift b/SuperLandoAdmin/AdminLib/Sources/AdminLib/UploadRace.swift index 3f09642..57370c7 100644 --- a/SuperLandoAdmin/AdminLib/Sources/AdminLib/UploadRace.swift +++ b/SuperLandoAdmin/AdminLib/Sources/AdminLib/UploadRace.swift @@ -24,6 +24,39 @@ public struct UploadRaceEvent: Codable, Equatable, Identifiable { var date: Date } +public enum UploadRaceEventBundle: Equatable { + case F1Sprint + case F1Regular + + var tag: String { + switch self { + case .F1Sprint, .F1Regular: + "f1" + } + } + + var events: [UploadRaceEvent] { + switch self { + case .F1Sprint: + [ + .init(title: "Practice 1", date: Date()), + .init(title: "Qualifying", date: Date()), + .init(title: "Practice 2", date: Date()), + .init(title: "Sprint", date: Date()), + .init(title: "Race", date: Date()), + ] + case .F1Regular: + [ + .init(title: "Practice 1", date: Date()), + .init(title: "Practice 2", date: Date()), + .init(title: "Practice 3", date: Date()), + .init(title: "Qualifying", date: Date()), + .init(title: "Race", date: Date()), + ] + } + } +} + public struct UploadRace: Reducer { public init() {} @@ -40,6 +73,7 @@ public struct UploadRace: Reducer { case uploadRace(APIClient.Action) case submitRace case addEvent + case addBundle(UploadRaceEventBundle) case updateEventTitle(UploadRaceEvent, String) case updateEventDate(UploadRaceEvent, Date) case binding(BindingAction) @@ -51,7 +85,16 @@ public struct UploadRace: Reducer { Reduce { state, action in switch action { case .addEvent: - state.events.append(.init(title: "", date: Date())) + if let ev = state.events.first { + state.events.append(.init(title: "", date: ev.date)) + } else { + state.events.append(.init(title: "", date: Date())) + } + return .none + + case .addBundle(let bundle): + state.raceTag = bundle.tag + state.events = bundle.events return .none case .updateEventTitle(let event, let title): @@ -82,7 +125,7 @@ public struct UploadRace: Reducer { try await send(.uploadRace(.request(.post(request)))) } - case .uploadRace(.response(.finished)): + case .uploadRace(.response(.finished(.success))): state.raceTitle = "" state.raceTag = "" state.events = [] @@ -146,6 +189,16 @@ public struct UploadRaceView: View { viewStore.send(.addEvent) } + Menu("add bundle") { + Button("F1 Sprint") { + viewStore.send(.addBundle(.F1Sprint)) + } + + Button("F1 Regular") { + viewStore.send(.addBundle(.F1Regular)) + } + } + } header: { Text("upload race") } footer: { diff --git a/SuperLandoAdmin/SuperLandoAdmin.xcodeproj/project.pbxproj b/SuperLandoAdmin/SuperLandoAdmin.xcodeproj/project.pbxproj index 03d3563..e764d65 100644 --- a/SuperLandoAdmin/SuperLandoAdmin.xcodeproj/project.pbxproj +++ b/SuperLandoAdmin/SuperLandoAdmin.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ /* Begin PBXFileReference section */ B40901912AC1B7B900B6F436 /* Upload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Upload.swift; sourceTree = ""; }; B40901932AC1C0E200B6F436 /* TestRequest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestRequest.swift; sourceTree = ""; }; + B42603E32AC59C43009F9936 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; B48609DB2AC126650098866E /* SuperLandoAdmin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SuperLandoAdmin.app; sourceTree = BUILT_PRODUCTS_DIR; }; B48609DE2AC126650098866E /* SuperLandoAdminApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SuperLandoAdminApp.swift; sourceTree = ""; }; B48609E02AC126650098866E /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; @@ -68,6 +69,7 @@ B48609DD2AC126650098866E /* SuperLandoAdmin */ = { isa = PBXGroup; children = ( + B42603E32AC59C43009F9936 /* Info.plist */, B48609EC2AC126860098866E /* SuperLandoAdmin.entitlements */, B48609DE2AC126650098866E /* SuperLandoAdminApp.swift */, B48609E02AC126650098866E /* ContentView.swift */, @@ -301,6 +303,7 @@ DEVELOPMENT_TEAM = 7N9Z7384YN; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SuperLandoAdmin/Info.plist; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; @@ -334,6 +337,7 @@ DEVELOPMENT_TEAM = 7N9Z7384YN; ENABLE_PREVIEWS = YES; GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = SuperLandoAdmin/Info.plist; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UILaunchScreen_Generation = YES; diff --git a/SuperLandoAdmin/SuperLandoAdmin/Info.plist b/SuperLandoAdmin/SuperLandoAdmin/Info.plist new file mode 100644 index 0000000..9f0981b --- /dev/null +++ b/SuperLandoAdmin/SuperLandoAdmin/Info.plist @@ -0,0 +1,19 @@ + + + + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + NSExceptionDomains + + http://quake.host + + NSIncludesSubdomains + + + + + + diff --git a/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift b/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift index a210516..9f74551 100644 --- a/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift +++ b/telegram/Sources/LandinhoBot/SwiftBot/SwiftyBot.swift @@ -210,11 +210,12 @@ final class DefaultVroomBot: SwiftyBot { } func formatEvent(_ event: RaceEvent) -> String { - "\(Self.formatter.string(from: event.date)) \(event.title)" + "\(Self.formatter.string(from: event.date)) - \(event.title)" } static let formatter = { let f = DateFormatter() + f.dateFormat = "MM/dd/yy HH:mm" return f }() } From fe83a48a9c870305e0b0dd0f51a1086962a7d94a Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Thu, 28 Sep 2023 12:25:07 -0300 Subject: [PATCH 7/8] attempts to fix deploy script --- deploy.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index 7cdcf0e..964f2ba 100644 --- a/deploy.sh +++ b/deploy.sh @@ -2,9 +2,12 @@ git fetch git pull origin main -cd telegram -swift build -sudo systemctl restart landinho.service -cd .. -cd backend -docker compose up -d \ No newline at end of file +( + cd telegram + swift build + sudo systemctl restart landinho.service +) +( + cd backend + docker compose up -d +) From fdf807251f95e02f5a93c72b1062630eb53b8184 Mon Sep 17 00:00:00 2001 From: Mauricio Cardozo Date: Thu, 28 Sep 2023 12:26:15 -0300 Subject: [PATCH 8/8] tells docker to build --- deploy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy.sh b/deploy.sh index 964f2ba..ac6af20 100644 --- a/deploy.sh +++ b/deploy.sh @@ -9,5 +9,5 @@ git pull origin main ) ( cd backend - docker compose up -d + docker compose up -d --build )