-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* resolve #189, you spin me right round * resolves #250, partially addresses #135 * resolves #214, adds pagination to moderator log * resolves #177, allows admin and tho in site ui with certain disable conditions * resolves #135, adds about processing via api * resolves #239, fixes pagination for joined fez and mod log * resolves #251, brings back new und alertwords and makes UI less surprising * The guts for #136 * more seamail muting * resolves #136, finalized mute of seamail I think * resolves #182, adds support for accessing mentions of twitarrteam and moderator * #206 bumps up minimum Vapor version, adds notes for concurrency checking * resolves #216, fixes seamail unread for special users (I think) * add dummy schedule generator * resolves #240, makes all lfgs not be perma-unread for moderators * resolves #173, implements late day flip setting * resolves #211, adds release calendar documentation * #132 make the site ui identify itself * comment * resolves #183, enables one context button for lfg and seamail * resolves #179, make open chat the default state * resolves #176, adds links to profiles for seamail participants * resolves #217, adds unread forum handlers * resolves #168, site ui marks new forum read for creator * resolves #199, correct forum counts after calendar update * resolves #188, adds team field to user profile * resolves #180, improves page titles for most common things * resolves #181, improves user mention and hashtag detection * resolves #210, moves preferredPronoun to UserHeader for wide consumability * add username to profile page titles * continues #231 add timeZoneID to FezData and ForumListdata to match EventData add timezoneID to forumlistdata like fezdata and eventdata * improve pronoun display by limiting to useful contexts * improve pronoun display by limiting to useful contexts * improve pronoun display with no displayname * resolves #167, adds view forum posts by user to mods * dedicated jobs for event schedule update * address occasional redis connection timeouts
- Loading branch information
Showing
77 changed files
with
1,221 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
import Foundation | ||
import Vapor | ||
|
||
// Generates a dummy schedule for use in testing. Mostly written by ChatGPT. | ||
func generateSchedule(startDate: Date, length: Int) { | ||
let dateFormatter = DateFormatter() | ||
dateFormatter.dateFormat = "yyyy-MM-dd" | ||
|
||
// Function to generate a random UID | ||
func generateUID() -> String { | ||
let characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ||
return String((0..<32).map { _ in characters.randomElement()! }) | ||
} | ||
|
||
// Print BEGIN:VCALENDAR only once before the first event | ||
let calHeaderString = """ | ||
BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
X-WR-CALNAME:JoCo Cruise Generated Schedule | ||
X-WR-CALDESC:Event Calendar | ||
METHOD:PUBLISH | ||
CALSCALE:GREGORIAN | ||
PRODID:-//Sched.com JoCo Cruise Generated Schedule//EN | ||
X-WR-TIMEZONE:UTC | ||
""" | ||
print(calHeaderString) | ||
|
||
for day in 0..<length { | ||
// Calculate date for the current day | ||
guard let currentDay = Calendar.current.date(byAdding: .day, value: day, to: startDate) else { | ||
fatalError("Error in date calculation.") | ||
} | ||
|
||
// Generate hourly events between 10AM and 4PM | ||
for hour in 10..<17 { | ||
let startTime = String(format: "%02d:00", hour) | ||
let endTime = String(format: "%02d:00", hour + 1) | ||
let summary = "Day \(day + 1) at \(hour)00" | ||
let description = "Event for Day \(day + 1) at \(hour)00" | ||
|
||
printEvent(date: currentDay, startTime: startTime, endTime: endTime, summary: summary, description: description, location: "", categories: "", uid: generateUID()) | ||
} | ||
|
||
// Red Team Dinner | ||
printEvent(date: currentDay, startTime: "17:00", endTime: "19:00", summary: "Red Team Dinner", description: "Dinner for Red Team", location: "Dining Room", categories: "", uid: generateUID()) | ||
|
||
// Gold Team Show | ||
printEvent(date: currentDay, startTime: "17:00", endTime: "19:00", summary: "Gold Team Show", description: "Show for Gold Team", location: "Main Stage", categories: "MAIN CONCERT", uid: generateUID()) | ||
|
||
// Gold Team Dinner | ||
printEvent(date: currentDay, startTime: "19:30", endTime: "21:30", summary: "Gold Team Dinner", description: "Dinner for Gold Team", location: "Dining Room", categories: "", uid: generateUID()) | ||
|
||
// Red Team Show | ||
printEvent(date: currentDay, startTime: "19:30", endTime: "21:30", summary: "Red Team Show", description: "Show for Red Team", location: "Main Stage", categories: "MAIN CONCERT", uid: generateUID()) | ||
|
||
// Morning Announcements | ||
printEvent(date: currentDay, startTime: "10:00", endTime: "10:15", summary: "Morning Announcements", description: "Daily morning announcements", location: "", categories: "", uid: generateUID()) | ||
|
||
// Happy Hour | ||
printEvent(date: currentDay, startTime: "16:00", endTime: "17:00", summary: "Happy Hour", description: "Happy Hour at Ocean Bar", location: "Ocean Bar", categories: "", uid: generateUID()) | ||
} | ||
|
||
// Print END:VCALENDAR only once after the last event | ||
print("END:VCALENDAR") | ||
} | ||
|
||
// Function to print events in ICS format | ||
func printEvent(date: Date, startTime: String, endTime: String, summary: String, description: String, location: String, categories: String, uid: String) { | ||
let dateFormatter = DateFormatter() | ||
dateFormatter.dateFormat = "yyyyMMdd'T'HHmmss'Z'" | ||
dateFormatter.timeZone = TimeZone(abbreviation: "UTC") | ||
|
||
let dtstamp = dateFormatter.string(from: Date()) | ||
let dtstart = dateFormatter.string(from: date.addingTimeInterval(TimeInterval(startTime.prefix(2))! * 3600 + TimeInterval(startTime.suffix(2))! * 60)) | ||
let dtend = dateFormatter.string(from: date.addingTimeInterval(TimeInterval(endTime.prefix(2))! * 3600 + TimeInterval(endTime.suffix(2))! * 60)) | ||
|
||
let icsString = """ | ||
BEGIN:VEVENT | ||
DTSTAMP:\(dtstamp) | ||
DTSTART:\(dtstart) | ||
DTEND:\(dtend) | ||
SUMMARY:\(summary) | ||
DESCRIPTION:\(description) | ||
CATEGORIES:\(categories) | ||
LOCATION:\(location) | ||
SEQUENCE:0 | ||
UID:\(uid) | ||
URL:https://twitarr.com/\(uid) | ||
END:VEVENT | ||
""" | ||
print(icsString) | ||
} | ||
|
||
struct GenerateScheduleCommand: AsyncCommand { | ||
struct Signature: CommandSignature { } | ||
|
||
var help: String { | ||
""" | ||
Generates a dummy schedule based on the currently configured cruise start date and length. \ | ||
Intended to help craft test data during a non-standard sailing (like if you want to test \ | ||
what's going to happen right NowTM). | ||
""" | ||
} | ||
|
||
func run(using context: CommandContext, signature: Signature) async throws { | ||
generateSchedule(startDate: Settings.shared.cruiseStartDate(), length: Settings.shared.cruiseLengthInDays) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.