gemenon

[ACTIVE] The Safari of the Gemini ecosystem
git clone git://git.figbert.com/gemenon.git
Log | Files | Refs

commit a43707a89450582fa665374d71bc943cd2406308
parent 83545232441ab1814a190873321787c66834ec9c
Author: FIGBERT <figbert@figbert.com>
Date:   Sat,  3 Sep 2022 14:05:13 -0700

Add primitive Gemini functionality

The client can now make requests and display the raw gemtext.

Diffstat:
MGemenon.xcodeproj/project.pbxproj | 44++++++++++++++++++++++++++++++++++++++++++++
AGemenon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved | 23+++++++++++++++++++++++
MShared/ContentView.swift | 20+++++++++++---------
MmacOS/macOS.entitlements | 10++++++----
4 files changed, 84 insertions(+), 13 deletions(-)

diff --git a/Gemenon.xcodeproj/project.pbxproj b/Gemenon.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ 3AB5B67E28BF23FF00F0C1A5 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AB5B66C28BF23FF00F0C1A5 /* ContentView.swift */; }; 3AB5B67F28BF23FF00F0C1A5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3AB5B66D28BF23FF00F0C1A5 /* Assets.xcassets */; }; 3AB5B68028BF23FF00F0C1A5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3AB5B66D28BF23FF00F0C1A5 /* Assets.xcassets */; }; + 3AD4A8B928C3EE120095B98E /* SwiftGemini in Frameworks */ = {isa = PBXBuildFile; productRef = 3AD4A8B828C3EE120095B98E /* SwiftGemini */; }; + 3AD4A8BC28C3EE440095B98E /* SwiftGemtext in Frameworks */ = {isa = PBXBuildFile; productRef = 3AD4A8BB28C3EE440095B98E /* SwiftGemtext */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -36,6 +38,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3AD4A8B928C3EE120095B98E /* SwiftGemini in Frameworks */, + 3AD4A8BC28C3EE440095B98E /* SwiftGemtext in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -111,6 +115,10 @@ dependencies = ( ); name = "Gemenon (macOS)"; + packageProductDependencies = ( + 3AD4A8B828C3EE120095B98E /* SwiftGemini */, + 3AD4A8BB28C3EE440095B98E /* SwiftGemtext */, + ); productName = "Gemenon (macOS)"; productReference = 3AB5B67828BF23FF00F0C1A5 /* Gemenon.app */; productType = "com.apple.product-type.application"; @@ -142,6 +150,10 @@ Base, ); mainGroup = 3AB5B66528BF23FF00F0C1A5; + packageReferences = ( + 3AD4A8B728C3EE120095B98E /* XCRemoteSwiftPackageReference "swiftgemini" */, + 3AD4A8BA28C3EE440095B98E /* XCRemoteSwiftPackageReference "swiftgemtext" */, + ); productRefGroup = 3AB5B67328BF23FF00F0C1A5 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -450,6 +462,38 @@ defaultConfigurationName = Release; }; /* End XCConfigurationList section */ + +/* Begin XCRemoteSwiftPackageReference section */ + 3AD4A8B728C3EE120095B98E /* XCRemoteSwiftPackageReference "swiftgemini" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "git://git.figbert.com/swiftgemini.git"; + requirement = { + branch = main; + kind = branch; + }; + }; + 3AD4A8BA28C3EE440095B98E /* XCRemoteSwiftPackageReference "swiftgemtext" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "git://git.figbert.com/swiftgemtext.git"; + requirement = { + branch = main; + kind = branch; + }; + }; +/* End XCRemoteSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 3AD4A8B828C3EE120095B98E /* SwiftGemini */ = { + isa = XCSwiftPackageProductDependency; + package = 3AD4A8B728C3EE120095B98E /* XCRemoteSwiftPackageReference "swiftgemini" */; + productName = SwiftGemini; + }; + 3AD4A8BB28C3EE440095B98E /* SwiftGemtext */ = { + isa = XCSwiftPackageProductDependency; + package = 3AD4A8BA28C3EE440095B98E /* XCRemoteSwiftPackageReference "swiftgemtext" */; + productName = SwiftGemtext; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 3AB5B66628BF23FF00F0C1A5 /* Project object */; } diff --git a/Gemenon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Gemenon.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -0,0 +1,23 @@ +{ + "pins" : [ + { + "identity" : "swiftgemini", + "kind" : "remoteSourceControl", + "location" : "git://git.figbert.com/swiftgemini.git", + "state" : { + "branch" : "main", + "revision" : "579c8a6eb8741adf8427cfd34c710c3503c88017" + } + }, + { + "identity" : "swiftgemtext", + "kind" : "remoteSourceControl", + "location" : "git://git.figbert.com/swiftgemtext.git", + "state" : { + "branch" : "main", + "revision" : "51dea98544e75035f72b38a800f0f2caddc96d87" + } + } + ], + "version" : 2 +} diff --git a/Shared/ContentView.swift b/Shared/ContentView.swift @@ -6,35 +6,37 @@ // import SwiftUI +import SwiftGemini +import SwiftGemtext struct ContentView: View { - @State private var url = URLBar() + @State private var url = "" @State private var columnVisibility = NavigationSplitViewVisibility.detailOnly + @State private var engine = SwiftGemini.GeminiRequestor() + @State private var response: SwiftGemini.GeminiResponse? + var body: some View { NavigationSplitView(columnVisibility: $columnVisibility) { Text("bookmarks") } detail: { - Text(url.url?.absoluteString ?? "") + Text(response?.body?.gemtext ?? "oops") } .toolbar { ToolbarItem(placement: .principal) { - TextField("Search or enter website name", text: $url.bar) + TextField("Search or enter website name", text: $url) .textFieldStyle(.roundedBorder) .autocorrectionDisabled(true) .onSubmit { - url.url = URL(string: url.bar) + Task { + response = try! await engine.request(URL(string: url)!) + } } } } } } -struct URLBar { - var bar = "" - var url: URL? = nil -} - struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() diff --git a/macOS/macOS.entitlements b/macOS/macOS.entitlements @@ -2,9 +2,11 @@ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> - <key>com.apple.security.app-sandbox</key> - <true/> - <key>com.apple.security.files.user-selected.read-only</key> - <true/> + <key>com.apple.security.app-sandbox</key> + <true/> + <key>com.apple.security.files.user-selected.read-only</key> + <true/> + <key>com.apple.security.network.client</key> + <true/> </dict> </plist>