diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f51eba7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,77 @@ +# ================================ +# Build image +# ================================ +FROM swift:5.10.1-jammy AS build + +# Install OS updates and, if needed, sqlite3 +RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ + && apt-get -q update \ + && apt-get -q dist-upgrade -y\ + && rm -rf /var/lib/apt/lists/* + +# Set up a build area +WORKDIR /build + +# First just resolve dependencies. +# This creates a cached layer that can be reused +# as long as your Package.swift/Package.resolved +# files do not change. +COPY ./Package.* ./ +RUN swift package resolve + +# Copy entire repo into container +COPY . . + +# Build everything, with optimizations +RUN swift build -c release --static-swift-stdlib + +# Switch to the staging area +WORKDIR /staging + +# Copy main executable to staging area +RUN cp "$(swift build --package-path /build -c release --show-bin-path)/Run" ./ + +# Copy resources bundled by SPM to staging area +RUN find -L "$(swift build --package-path /build -c release --show-bin-path)/" -regex '.*\.resources$' -exec cp -Ra {} ./ \; + +# Copy any resources from the public directory and views directory if the directories exist +# Ensure that by default, neither the directory nor any of its contents are writable. +RUN [ -d /build/Public ] && { mv /build/Public ./Public && chmod -R a-w ./Public; } || true +RUN [ -d /build/Resources ] && { mv /build/Resources ./Resources && chmod -R a-w ./Resources; } || true + +# ================================ +# Run image +# ================================ +FROM ubuntu:jammy + +# Make sure all system packages are up to date, and install only essential packages. +RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ + && apt-get -q update \ + && apt-get -q dist-upgrade -y \ + && apt-get -q install -y \ + ca-certificates \ + tzdata \ +# If your app or its dependencies import FoundationNetworking, also install `libcurl4`. + # libcurl4 \ +# If your app or its dependencies import FoundationXML, also install `libxml2`. + # libxml2 \ + && rm -r /var/lib/apt/lists/* + +# Create a vapor user and group with /app as its home directory +RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app vapor + +# Switch to the new home directory +WORKDIR /app + +# Copy built executable and any staged resources from builder +COPY --from=build --chown=vapor:vapor /staging /app + +# Ensure all further commands run as the vapor user +USER vapor:vapor + +# Let Docker bind to port 8080 +EXPOSE 8080 + +# Start the Vapor service when the image is run, default to listening on 8080 in production environment +ENTRYPOINT ["./Run"] +CMD ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8080"] diff --git a/smparkin.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Package.resolved similarity index 62% rename from smparkin.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved rename to Package.resolved index 5a731c2..c902b82 100644 --- a/smparkin.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Package.resolved @@ -1,13 +1,12 @@ { - "originHash" : "72522807f64a92bdddb842babbc3889aa60e931be5959af76e1c0e4b69bca532", "pins" : [ { "identity" : "async-http-client", "kind" : "remoteSourceControl", "location" : "https://github.com/swift-server/async-http-client.git", "state" : { - "revision" : "a22083713ee90808d527d0baa290c2fb13ca3096", - "version" : "1.21.1" + "revision" : "864c8d9e0ead5de7ba70b61c8982f89126710863", + "version" : "1.15.0" } }, { @@ -15,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/async-kit.git", "state" : { - "revision" : "7ece208cd401687641c88367a00e3ea2b04311f1", - "version" : "1.19.0" + "revision" : "9acea4c92f51a5885c149904f0d11db4712dda80", + "version" : "1.16.0" } }, { @@ -24,8 +23,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/console-kit.git", "state" : { - "revision" : "9c24ac496c97cfb49c1bd5e7162008bb50abafc8", - "version" : "4.14.2" + "revision" : "447f1046fb4e9df40973fe426ecb24a6f0e8d3b4", + "version" : "4.6.0" } }, { @@ -33,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/leaf.git", "state" : { - "revision" : "0be8765af9991823c854d97faa4a97db1cfa2643", - "version" : "4.3.0" + "revision" : "6fe0e843c6599f5189e45c7b08739ebc5c410c3b", + "version" : "4.2.4" } }, { @@ -42,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/leaf-kit.git", "state" : { - "revision" : "547e48cc5f8d98380dd8a7226ce630d3aa3b2245", - "version" : "1.10.6" + "revision" : "62169b44cc79734e11bf44b8d7154865dee5936b", + "version" : "1.10.1" } }, { @@ -51,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/multipart-kit.git", "state" : { - "revision" : "12ee56f25bd3fc4c2d09c2aa16e69de61dc786e8", - "version" : "4.6.0" + "revision" : "0d55c35e788451ee27222783c7d363cb88092fab", + "version" : "4.5.2" } }, { @@ -60,8 +59,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/routing-kit.git", "state" : { - "revision" : "8c9a227476555c55837e569be71944e02a056b72", - "version" : "4.9.1" + "revision" : "ffac7b3a127ce1e85fb232f1a6271164628809ad", + "version" : "4.6.0" } }, { @@ -69,8 +68,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-algorithms.git", "state" : { - "revision" : "f6919dfc309e7f1b56224378b11e28bab5bccc42", - "version" : "1.2.0" + "revision" : "b14b7f4c528c942f121c8b860b9410b2bf57825e", + "version" : "1.0.0" } }, { @@ -78,8 +77,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-atomics.git", "state" : { - "revision" : "cd142fd2f64be2100422d658e7411e39489da985", - "version" : "1.2.0" + "revision" : "ff3d2212b6b093db7f177d0855adbc4ef9c5f036", + "version" : "1.0.3" + } + }, + { + "identity" : "swift-backtrace", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-backtrace.git", + "state" : { + "revision" : "f25620d5d05e2f1ba27154b40cafea2b67566956", + "version" : "1.3.3" } }, { @@ -87,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-collections.git", "state" : { - "revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb", - "version" : "1.1.0" + "revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2", + "version" : "1.0.4" } }, { @@ -96,17 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "bc1c29221f6dfeb0ebbfbc98eb95cd3d4967868e", - "version" : "3.4.0" - } - }, - { - "identity" : "swift-http-types", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-http-types", - "state" : { - "revision" : "9bee2fdb79cc740081abd8ebd80738063d632286", - "version" : "1.1.0" + "revision" : "da0fe44138ab86e380f40a2acbd8a611b07d3f64", + "version" : "2.4.0" } }, { @@ -114,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "e97a6fcb1ab07462881ac165fdbb37f067e205d5", - "version" : "1.5.4" + "revision" : "32e8d724467f8fe623624570367e3d50c5638e46", + "version" : "1.5.2" } }, { @@ -123,8 +122,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-metrics.git", "state" : { - "revision" : "eb18581491dfb266a2342f74e0bdd42c14798297", - "version" : "2.4.2" + "revision" : "e8bced74bc6d747745935e469f45d03f048d6cbd", + "version" : "2.3.4" } }, { @@ -132,8 +131,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "359c461e5561d22c6334828806cc25d759ca7aa6", - "version" : "2.65.0" + "revision" : "45167b8006448c79dda4b7bd604e07a034c15c49", + "version" : "2.48.0" } }, { @@ -141,8 +140,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-extras.git", "state" : { - "revision" : "a3b640d7dc567225db7c94386a6e71aded1bfa63", - "version" : "1.22.0" + "revision" : "d75ed708d00353acf173ca23018b6bd46f949464", + "version" : "1.17.0" } }, { @@ -150,8 +149,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-http2.git", "state" : { - "revision" : "c6afe04165c865faaa687b42c32ed76dfcc91076", - "version" : "1.31.0" + "revision" : "38feec96bcd929028939107684073554bf01abeb", + "version" : "1.25.2" } }, { @@ -159,8 +158,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-ssl.git", "state" : { - "revision" : "7c381eb6083542b124a6c18fae742f55001dc2b5", - "version" : "2.26.0" + "revision" : "4fb7ead803e38949eb1d6fabb849206a72c580f3", + "version" : "2.23.0" } }, { @@ -168,8 +167,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-transport-services.git", "state" : { - "revision" : "38ac8221dd20674682148d6451367f89c2652980", - "version" : "1.21.0" + "revision" : "c0d9a144cfaec8d3d596aadde3039286a266c15c", + "version" : "1.15.0" } }, { @@ -181,22 +180,13 @@ "version" : "1.0.2" } }, - { - "identity" : "swift-system", - "kind" : "remoteSourceControl", - "location" : "https://github.com/apple/swift-system.git", - "state" : { - "revision" : "025bcb1165deab2e20d4eaba79967ce73013f496", - "version" : "1.2.1" - } - }, { "identity" : "vapor", "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/vapor.git", "state" : { - "revision" : "5bc1dfa47e533ed1d20151ebdaff372e900472d9", - "version" : "4.99.3" + "revision" : "bac0fe31e3b186537eb750d44fae048681e2b773", + "version" : "4.74.0" } }, { @@ -204,10 +194,10 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/vapor/websocket-kit.git", "state" : { - "revision" : "4232d34efa49f633ba61afde365d3896fc7f8740", - "version" : "2.15.0" + "revision" : "2b8885974e8d9f522e787805000553f4f7cce8a0", + "version" : "2.7.0" } } ], - "version" : 3 + "version" : 2 } diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..7fe7054 --- /dev/null +++ b/Package.swift @@ -0,0 +1,39 @@ +// swift-tools-version:5.7 +import PackageDescription + +let package = Package( + name: "smparkin", + platforms: [ + .macOS(.v13) + ], + dependencies: [ + .package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "4.0.0")), + .package(url: "https://github.com/vapor/leaf.git", .upToNextMajor(from: "4.0.0")), + ], + targets: [ + .target( + name: "App", + dependencies: [ + .product(name: "Vapor", package: "vapor"), + .product(name: "Leaf", package: "leaf") + ], + swiftSettings: [ + .unsafeFlags(["-cross-module-optimization"], .when(configuration: .release)) + ] + ), + .executableTarget( + name: "Run", + dependencies: [ + .target(name: "App") + ] + ), + .testTarget( + name: "AppTests", + dependencies: [ + .target(name: "App"), + .product(name: "XCTVapor", package: "vapor") + ] + ) + ] +) + diff --git a/smparkin/Public/css/404style.css b/Public/css/404style.css similarity index 100% rename from smparkin/Public/css/404style.css rename to Public/css/404style.css diff --git a/smparkin/Public/images/bg.jpg b/Public/images/bg.jpg similarity index 100% rename from smparkin/Public/images/bg.jpg rename to Public/images/bg.jpg diff --git a/smparkin/Public/images/me.jpg b/Public/images/me.jpg similarity index 100% rename from smparkin/Public/images/me.jpg rename to Public/images/me.jpg diff --git a/smparkin/Public/images/trees.jpg b/Public/images/trees.jpg similarity index 100% rename from smparkin/Public/images/trees.jpg rename to Public/images/trees.jpg diff --git a/smparkin/Public/media/gif.gif b/Public/media/gif.gif similarity index 100% rename from smparkin/Public/media/gif.gif rename to Public/media/gif.gif diff --git a/smparkin/Public/media/gif2.gif b/Public/media/gif2.gif similarity index 100% rename from smparkin/Public/media/gif2.gif rename to Public/media/gif2.gif diff --git a/smparkin/Public/media/song.mp3 b/Public/media/song.mp3 similarity index 100% rename from smparkin/Public/media/song.mp3 rename to Public/media/song.mp3 diff --git a/README.md b/README.md new file mode 100644 index 0000000..cc2ec01 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +smpark.in diff --git a/smparkin/Views/404.leaf b/Resources/Views/404.leaf similarity index 100% rename from smparkin/Views/404.leaf rename to Resources/Views/404.leaf diff --git a/smparkin/Views/home.leaf b/Resources/Views/home.leaf similarity index 77% rename from smparkin/Views/home.leaf rename to Resources/Views/home.leaf index e449a3d..6657c4b 100644 --- a/smparkin/Views/home.leaf +++ b/Resources/Views/home.leaf @@ -15,37 +15,32 @@ background-color: #1e1e1e; padding: 20px; text-align: center; - border-bottom: 2px solid #9370db; + border-bottom: 2px solid #9370db !important; } header h1 { margin: 0; - color: #9370db; + color: #9370db !important; } header img { max-width: 150px; height: auto; border-radius: 50%; - border: 2px solid #9370db; + border: 2px solid #9370db !important; margin: 10px 0; } - nav { - display: flex; - justify-content: center; - flex-wrap: wrap; - margin: 20px 0; - } - nav a { - color: #9370db; + a:link, + a:visited { + color: #9370db !important; text-decoration: none; - margin: 5px 15px; - padding: 10px 20px; - border: 1px solid #9370db; - border-radius: 5px; transition: background-color 0.3s, color 0.3s; } - nav a:hover { - background-color: #9370db; - color: #ffffff; + a:hover { + background-color: #9370db !important; + color: #ffffff !important; + } + a:active { + background-color: #9370db !important; + color: #ffffff !important; } section { max-width: 800px; @@ -61,13 +56,13 @@ display: block; margin: 0 auto 20px auto; border-radius: 10px; - border: 2px solid #9370db; + border: 2px solid #9370db !important; } footer { text-align: center; padding: 20px; background-color: #1e1e1e; - border-top: 2px solid #9370db; + border-top: 2px solid #9370db !important; } @@ -80,10 +75,6 @@

Stephen Parkinson

Systems Development Engineer

-

About Me

I'm doing a lot of stuff with computers right now.

diff --git a/smparkin/Views/privacy.leaf b/Resources/Views/privacy.leaf similarity index 100% rename from smparkin/Views/privacy.leaf rename to Resources/Views/privacy.leaf diff --git a/smparkin/Views/welcome.leaf b/Resources/Views/welcome.leaf similarity index 100% rename from smparkin/Views/welcome.leaf rename to Resources/Views/welcome.leaf diff --git a/Sources/App/configure.swift b/Sources/App/configure.swift new file mode 100644 index 0000000..746898b --- /dev/null +++ b/Sources/App/configure.swift @@ -0,0 +1,15 @@ +import Leaf +import Vapor + +// Called before your application initializes. +public func configure(_ app: Application) throws { + //leaf + app.views.use(.leaf) + + //Register middleware + app.middleware.use(FileMiddleware(publicDirectory: app.directory.publicDirectory)) + app.middleware.use(ErrorMiddleware.default(environment: app.environment)) + + //routes + try routes(app) +} diff --git a/smparkin/Routes.swift b/Sources/App/routes.swift similarity index 100% rename from smparkin/Routes.swift rename to Sources/App/routes.swift diff --git a/Sources/Run/main.swift b/Sources/Run/main.swift new file mode 100644 index 0000000..373be5f --- /dev/null +++ b/Sources/Run/main.swift @@ -0,0 +1,9 @@ +import App +import Vapor + +var env = try Environment.detect() +try LoggingSystem.bootstrap(from: &env) +let app = Application(env) +defer { app.shutdown() } +try configure(app) +try app.run() diff --git a/Tests/AppTests/AppTests.swift b/Tests/AppTests/AppTests.swift new file mode 100644 index 0000000..d915e80 --- /dev/null +++ b/Tests/AppTests/AppTests.swift @@ -0,0 +1,12 @@ +import XCTest +@testable import App + +class AppTests: XCTestCase { + func testStub() throws { + XCTAssert(true) + } + + static let allTests = [ + ("testStub", testStub), + ] +} diff --git a/Tests/LinuxMain.swift b/Tests/LinuxMain.swift new file mode 100644 index 0000000..f78cb77 --- /dev/null +++ b/Tests/LinuxMain.swift @@ -0,0 +1,11 @@ +#if os(Linux) + +import XCTest +@testable import AppTests + +XCTMain([ + // AppTests + testCase(AppTests.allTests), +]) + +#endif diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c46e129 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,30 @@ +# Docker Compose file for Vapor +# +# Install Docker on your system to run and test +# your Vapor app in a production-like environment. +# +# Note: This file is intended for testing and does not +# implement best practices for a production deployment. +# +# Learn more: https://docs.docker.com/compose/reference/ +# +# Build images: docker-compose build +# Start app: docker-compose up app +# Stop all: docker-compose down +# +version: '3.7' + +x-shared_environment: &shared_environment + LOG_LEVEL: ${LOG_LEVEL:-debug} + +services: + app: + image: smparkin:latest + build: + context: . + environment: + <<: *shared_environment + ports: + - '8888:8888' + # user: '0' # uncomment to run as root for testing purposes even though Dockerfile defines 'vapor' user. + command: ["serve", "--env", "production", "--hostname", "0.0.0.0", "--port", "8888"] diff --git a/smparkin.xcodeproj/project.pbxproj b/smparkin.xcodeproj/project.pbxproj deleted file mode 100644 index dd6d023..0000000 --- a/smparkin.xcodeproj/project.pbxproj +++ /dev/null @@ -1,439 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 56; - objects = { - -/* Begin PBXBuildFile section */ - C041F2C22AB021E30011752C /* smparkinApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = C041F2C12AB021E30011752C /* smparkinApp.swift */; }; - C041F2C42AB021E30011752C /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C041F2C32AB021E30011752C /* ContentView.swift */; }; - C041F2C62AB021E40011752C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C041F2C52AB021E40011752C /* Assets.xcassets */; }; - C041F2C92AB021E40011752C /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C041F2C82AB021E40011752C /* Preview Assets.xcassets */; }; - C041F2D22AB0238F0011752C /* Vapor in Frameworks */ = {isa = PBXBuildFile; productRef = C041F2D12AB0238F0011752C /* Vapor */; }; - C041F2D72AB023CA0011752C /* Leaf in Frameworks */ = {isa = PBXBuildFile; productRef = C041F2D62AB023CA0011752C /* Leaf */; }; - C041F2DA2AB0243C0011752C /* Public in Resources */ = {isa = PBXBuildFile; fileRef = C041F2D82AB0243C0011752C /* Public */; }; - C041F2DD2AB024510011752C /* Routes.swift in Sources */ = {isa = PBXBuildFile; fileRef = C041F2DC2AB024510011752C /* Routes.swift */; }; - C041F2DF2AB0246C0011752C /* Server.swift in Sources */ = {isa = PBXBuildFile; fileRef = C041F2DE2AB0246C0011752C /* Server.swift */; }; - C0C8E2BE2AB0304D00E809B4 /* home.leaf in Resources */ = {isa = PBXBuildFile; fileRef = C0C8E2BB2AB02B6C00E809B4 /* home.leaf */; }; - C0C8E2BF2AB0304D00E809B4 /* privacy.leaf in Resources */ = {isa = PBXBuildFile; fileRef = C0C8E2BC2AB02B6C00E809B4 /* privacy.leaf */; }; - C0C8E2C02AB0304D00E809B4 /* welcome.leaf in Resources */ = {isa = PBXBuildFile; fileRef = C0C8E2BD2AB02B6C00E809B4 /* welcome.leaf */; }; - C0C8E2C12AB0304D00E809B4 /* 404.leaf in Resources */ = {isa = PBXBuildFile; fileRef = C0C8E2BA2AB02B6C00E809B4 /* 404.leaf */; }; - C0C8E2C52AB03D6200E809B4 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = C0C8E2C42AB03D6200E809B4 /* Log.swift */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - C041F2BE2AB021E30011752C /* smparkin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = smparkin.app; sourceTree = BUILT_PRODUCTS_DIR; }; - C041F2C12AB021E30011752C /* smparkinApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = smparkinApp.swift; sourceTree = ""; }; - C041F2C32AB021E30011752C /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - C041F2C52AB021E40011752C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; - C041F2C82AB021E40011752C /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; - C041F2D82AB0243C0011752C /* Public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Public; sourceTree = ""; }; - C041F2DC2AB024510011752C /* Routes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Routes.swift; sourceTree = ""; }; - C041F2DE2AB0246C0011752C /* Server.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Server.swift; sourceTree = ""; }; - C0C8E2BA2AB02B6C00E809B4 /* 404.leaf */ = {isa = PBXFileReference; lastKnownFileType = text; path = 404.leaf; sourceTree = ""; }; - C0C8E2BB2AB02B6C00E809B4 /* home.leaf */ = {isa = PBXFileReference; lastKnownFileType = text; path = home.leaf; sourceTree = ""; }; - C0C8E2BC2AB02B6C00E809B4 /* privacy.leaf */ = {isa = PBXFileReference; lastKnownFileType = text; path = privacy.leaf; sourceTree = ""; }; - C0C8E2BD2AB02B6C00E809B4 /* welcome.leaf */ = {isa = PBXFileReference; lastKnownFileType = text; path = welcome.leaf; sourceTree = ""; }; - C0C8E2C42AB03D6200E809B4 /* Log.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Log.swift; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - C041F2BB2AB021E30011752C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - C041F2D72AB023CA0011752C /* Leaf in Frameworks */, - C041F2D22AB0238F0011752C /* Vapor in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - C041F2B52AB021E30011752C = { - isa = PBXGroup; - children = ( - C041F2C02AB021E30011752C /* smparkin */, - C041F2BF2AB021E30011752C /* Products */, - ); - sourceTree = ""; - }; - C041F2BF2AB021E30011752C /* Products */ = { - isa = PBXGroup; - children = ( - C041F2BE2AB021E30011752C /* smparkin.app */, - ); - name = Products; - sourceTree = ""; - }; - C041F2C02AB021E30011752C /* smparkin */ = { - isa = PBXGroup; - children = ( - C041F2C12AB021E30011752C /* smparkinApp.swift */, - C041F2C32AB021E30011752C /* ContentView.swift */, - C041F2DE2AB0246C0011752C /* Server.swift */, - C041F2DC2AB024510011752C /* Routes.swift */, - C0C8E2C42AB03D6200E809B4 /* Log.swift */, - C0C8E2B92AB02B6C00E809B4 /* Views */, - C041F2D82AB0243C0011752C /* Public */, - C041F2C52AB021E40011752C /* Assets.xcassets */, - C041F2C72AB021E40011752C /* Preview Content */, - ); - path = smparkin; - sourceTree = ""; - }; - C041F2C72AB021E40011752C /* Preview Content */ = { - isa = PBXGroup; - children = ( - C041F2C82AB021E40011752C /* Preview Assets.xcassets */, - ); - path = "Preview Content"; - sourceTree = ""; - }; - C0C8E2B92AB02B6C00E809B4 /* Views */ = { - isa = PBXGroup; - children = ( - C0C8E2BA2AB02B6C00E809B4 /* 404.leaf */, - C0C8E2BB2AB02B6C00E809B4 /* home.leaf */, - C0C8E2BC2AB02B6C00E809B4 /* privacy.leaf */, - C0C8E2BD2AB02B6C00E809B4 /* welcome.leaf */, - ); - path = Views; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - C041F2BD2AB021E30011752C /* smparkin */ = { - isa = PBXNativeTarget; - buildConfigurationList = C041F2CC2AB021E40011752C /* Build configuration list for PBXNativeTarget "smparkin" */; - buildPhases = ( - C041F2BA2AB021E30011752C /* Sources */, - C041F2BB2AB021E30011752C /* Frameworks */, - C041F2BC2AB021E30011752C /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = smparkin; - packageProductDependencies = ( - C041F2D12AB0238F0011752C /* Vapor */, - C041F2D62AB023CA0011752C /* Leaf */, - ); - productName = smparkin; - productReference = C041F2BE2AB021E30011752C /* smparkin.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - C041F2B62AB021E30011752C /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1500; - LastUpgradeCheck = 1500; - TargetAttributes = { - C041F2BD2AB021E30011752C = { - CreatedOnToolsVersion = 15.0; - }; - }; - }; - buildConfigurationList = C041F2B92AB021E30011752C /* Build configuration list for PBXProject "smparkin" */; - compatibilityVersion = "Xcode 14.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = C041F2B52AB021E30011752C; - packageReferences = ( - C041F2D02AB0238F0011752C /* XCRemoteSwiftPackageReference "vapor" */, - C041F2D52AB023CA0011752C /* XCRemoteSwiftPackageReference "leaf" */, - ); - productRefGroup = C041F2BF2AB021E30011752C /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - C041F2BD2AB021E30011752C /* smparkin */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - C041F2BC2AB021E30011752C /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C0C8E2BE2AB0304D00E809B4 /* home.leaf in Resources */, - C0C8E2C12AB0304D00E809B4 /* 404.leaf in Resources */, - C041F2C92AB021E40011752C /* Preview Assets.xcassets in Resources */, - C041F2DA2AB0243C0011752C /* Public in Resources */, - C041F2C62AB021E40011752C /* Assets.xcassets in Resources */, - C0C8E2C02AB0304D00E809B4 /* welcome.leaf in Resources */, - C0C8E2BF2AB0304D00E809B4 /* privacy.leaf in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - C041F2BA2AB021E30011752C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - C041F2DF2AB0246C0011752C /* Server.swift in Sources */, - C041F2C42AB021E30011752C /* ContentView.swift in Sources */, - C0C8E2C52AB03D6200E809B4 /* Log.swift in Sources */, - C041F2C22AB021E30011752C /* smparkinApp.swift in Sources */, - C041F2DD2AB024510011752C /* Routes.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - C041F2CA2AB021E40011752C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - }; - name = Debug; - }; - C041F2CB2AB021E40011752C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - GCC_C_LANGUAGE_STANDARD = gnu17; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - C041F2CD2AB021E40011752C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"smparkin/Preview Content\""; - DEVELOPMENT_TEAM = QR825BQSTL; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = in.smpark.smparkin; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - C041F2CE2AB021E40011752C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_ASSET_PATHS = "\"smparkin/Preview Content\""; - DEVELOPMENT_TEAM = QR825BQSTL; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; - IPHONEOS_DEPLOYMENT_TARGET = 15.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = in.smpark.smparkin; - PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_EMIT_LOC_STRINGS = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - C041F2B92AB021E30011752C /* Build configuration list for PBXProject "smparkin" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C041F2CA2AB021E40011752C /* Debug */, - C041F2CB2AB021E40011752C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C041F2CC2AB021E40011752C /* Build configuration list for PBXNativeTarget "smparkin" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C041F2CD2AB021E40011752C /* Debug */, - C041F2CE2AB021E40011752C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - C041F2D02AB0238F0011752C /* XCRemoteSwiftPackageReference "vapor" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/vapor/vapor.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 4.81.0; - }; - }; - C041F2D52AB023CA0011752C /* XCRemoteSwiftPackageReference "leaf" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/vapor/leaf.git"; - requirement = { - kind = upToNextMajorVersion; - minimumVersion = 4.2.4; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - C041F2D12AB0238F0011752C /* Vapor */ = { - isa = XCSwiftPackageProductDependency; - package = C041F2D02AB0238F0011752C /* XCRemoteSwiftPackageReference "vapor" */; - productName = Vapor; - }; - C041F2D62AB023CA0011752C /* Leaf */ = { - isa = XCSwiftPackageProductDependency; - package = C041F2D52AB023CA0011752C /* XCRemoteSwiftPackageReference "leaf" */; - productName = Leaf; - }; -/* End XCSwiftPackageProductDependency section */ - }; - rootObject = C041F2B62AB021E30011752C /* Project object */; -} diff --git a/smparkin.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/smparkin.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 919434a..0000000 --- a/smparkin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/smparkin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/smparkin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d9810..0000000 --- a/smparkin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - - diff --git a/smparkin.xcodeproj/project.xcworkspace/xcuserdata/smparkin.xcuserdatad/UserInterfaceState.xcuserstate b/smparkin.xcodeproj/project.xcworkspace/xcuserdata/smparkin.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 5418b25..0000000 Binary files a/smparkin.xcodeproj/project.xcworkspace/xcuserdata/smparkin.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/smparkin.xcodeproj/xcuserdata/smparkin.xcuserdatad/xcschemes/xcschememanagement.plist b/smparkin.xcodeproj/xcuserdata/smparkin.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 24b24c7..0000000 --- a/smparkin.xcodeproj/xcuserdata/smparkin.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - SchemeUserState - - smparkin.xcscheme_^#shared#^_ - - orderHint - 0 - - - - diff --git a/smparkin/Assets.xcassets/AccentColor.colorset/Contents.json b/smparkin/Assets.xcassets/AccentColor.colorset/Contents.json deleted file mode 100644 index eb87897..0000000 --- a/smparkin/Assets.xcassets/AccentColor.colorset/Contents.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "colors" : [ - { - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/smparkin/Assets.xcassets/AppIcon.appiconset/Contents.json b/smparkin/Assets.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 13613e3..0000000 --- a/smparkin/Assets.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "platform" : "ios", - "size" : "1024x1024" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/smparkin/Assets.xcassets/Contents.json b/smparkin/Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/smparkin/Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/smparkin/ContentView.swift b/smparkin/ContentView.swift deleted file mode 100644 index 166fd04..0000000 --- a/smparkin/ContentView.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// ContentView.swift -// smparkin -// -// Created by Stephen Parkinson on 9/11/23. -// - -import SwiftUI - -struct ContentView: View { - @StateObject var server: Server = Server(port: 8080) - - var body: some View { - VStack { - Text(ProcessInfo().hostName + ":\(server.port)") - List(server.logs.reversed(), id: \.self) { log in - Text(log) - } - } - .padding() - .onAppear { - server.start() - } - } -} - -#Preview { - ContentView() -} diff --git a/smparkin/Log.swift b/smparkin/Log.swift deleted file mode 100644 index 6d3e552..0000000 --- a/smparkin/Log.swift +++ /dev/null @@ -1,23 +0,0 @@ -// -// Log.swift -// smparkin -// -// Created by Stephen Parkinson on 9/11/23. -// - -import Vapor - -struct LogMiddleware: Middleware { - let server: Server - - init(server: Server) { - self.server = server - } - - func respond(to request: Request, chainingTo next: Responder) -> EventLoopFuture { - DispatchQueue.main.async { - server.logs.append("\(server.dateFormatter.string(from: Date.now)) \(request.url.path)") - } - return next.respond(to: request) - } -} diff --git a/smparkin/Preview Content/Preview Assets.xcassets/Contents.json b/smparkin/Preview Content/Preview Assets.xcassets/Contents.json deleted file mode 100644 index 73c0059..0000000 --- a/smparkin/Preview Content/Preview Assets.xcassets/Contents.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/smparkin/Server.swift b/smparkin/Server.swift deleted file mode 100644 index 4e5a9c8..0000000 --- a/smparkin/Server.swift +++ /dev/null @@ -1,58 +0,0 @@ -import Leaf -import Vapor -import SwiftUI - -class Server: ObservableObject { - @Published var logs: [String] = [String]() - let dateFormatter = ISO8601DateFormatter() - var app: Application - let port: Int - - init(port: Int) { - self.port = port - app = Application(.production) - configure(app) - } - - // Called before your application initializes. - private func configure(_ app: Application) { - app.http.server.configuration.hostname = "0.0.0.0" - app.http.server.configuration.port = port - - //leaf - app.views.use(.leaf) - app.leaf.cache.isEnabled = app.environment.isRelease - app.leaf.configuration.rootDirectory = Bundle.main.bundlePath - - //Register middleware - app.middleware.use(FileMiddleware(publicDirectory: "\(Bundle.main.bundlePath)/\(app.directory.publicDirectory)")) - app.middleware.use(ErrorMiddleware.default(environment: app.environment)) - app.middleware.use(LogMiddleware.init(server: self)) - - //routes - do { - try routes(app) - } catch { - fatalError(error.localizedDescription) - } - } - - func start() { - Task(priority: .userInitiated) { - do { - try app.start() - } catch { - fatalError(error.localizedDescription) - } - } - } - - func stop() { - app.shutdown() - } - - func restart() { - stop() - start() - } -} diff --git a/smparkin/smparkinApp.swift b/smparkin/smparkinApp.swift deleted file mode 100644 index fcd6cd6..0000000 --- a/smparkin/smparkinApp.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// smparkinApp.swift -// smparkin -// -// Created by Stephen Parkinson on 9/11/23. -// - -import SwiftUI - -@main -struct smparkinApp: App { - var body: some Scene { - WindowGroup { - ContentView() - } - } -}