Skip to content

Commit c9130f0

Browse files
committed
fix: hide residency, improve date on posts
1 parent 88d0bf6 commit c9130f0

File tree

5 files changed

+32
-10
lines changed

5 files changed

+32
-10
lines changed

Sources/ActivityClient/Client.swift

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,19 @@ public struct ActivityClient: Sendable {
1111
}
1212

1313
extension ActivityClient {
14-
public func activity() -> Activity {
15-
.init(
16-
location: self.location(),
14+
public func redactedActivity() -> Activity {
15+
let location = self.location()
16+
let redactedLocation = location.flatMap {
17+
Location(
18+
city: $0.city,
19+
state: $0.state,
20+
region: $0.region,
21+
timestamp: $0.timestamp,
22+
residency: nil
23+
)
24+
}
25+
return Activity(
26+
location: redactedLocation,
1727
nowPlaying: self.nowPlaying()
1828
)
1929
}

Sources/App/Middlewares/SiteMiddleware.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct SiteMiddleware<Context: RequestContext>: RouterController {
3838
return HomePage(codeLang: .resolve(req))
3939
case .api(.activity(.all)):
4040
do {
41-
return try JSONEncoder().encode(self.activityClient.activity(), from: req, context: ctx)
41+
return try JSONEncoder().encode(self.activityClient.redactedActivity(), from: req, context: ctx)
4242
} catch {
4343
throw HTTPError(.forbidden)
4444
}

Sources/Pages/HomePage.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,7 @@ private struct PostsView: HTML {
295295
let selected: Vue.Expression<CodeLang?>
296296

297297
var body: some HTML {
298-
article(
299-
.id(self.post.slug)
300-
// ,
301-
// .v.show("!selection || selection == '\(self.post.kind.rawValue)'")
302-
) {
298+
article(.id(self.post.slug)) {
303299
header {
304300
hgroup {
305301
span { self.post.datePosted.uppercased() }

Sources/Pages/Models/Post+AllCases.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,22 @@ extension Post: CaseIterable {
103103
),
104104
]
105105
),
106+
Self(
107+
title: "XTool is Awesome",
108+
content: """
109+
[xtool](https://github.com/xtool-org/xtool) is a tool that attempts to replace Xcode and use Swift Package Manager to \
110+
build and deploy iOS apps on macOS, Linux, and Windows! \
111+
I have been working closely with the developer to support for App Extensions and also resolve additional issues.
112+
113+
I hope to also replace "AppleProductTypes", a library used to build iOS and macOS apps using Swift Playgrounds, in favor of \
114+
"XToolProductTypes."
115+
""",
116+
date: Date(month: 7, day: 20, year: 2025),
117+
kind: .blog,
118+
hidden: true
119+
)
106120
]
107121
.sorted { $0.date < $1.date }
122+
.filter { !$0.hidden }
108123
}
109124
}

Sources/Pages/Models/Post.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,13 @@ struct Post: Sendable {
1010
var lastUpdated: Date?
1111
let kind: Kind
1212
var links: [Link] = []
13+
var hidden = false
1314

1415
private static let dateCreatedFormatter = {
1516
let formatter = DateFormatter()
1617
formatter.locale = Locale(languageCode: .english, languageRegion: .unitedStates)
1718
formatter.timeZone = TimeZone(abbreviation: "PST") ?? formatter.timeZone
18-
formatter.dateFormat = "MMM, d yyyy"
19+
formatter.dateFormat = "MMM d, yyyy"
1920
return formatter
2021
}()
2122

0 commit comments

Comments
 (0)