Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 9 additions & 24 deletions HackerTube/Features/Search/SearchSuggestion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,13 @@ struct SearchSuggestion: Identifiable {
}

extension SearchSuggestion {
static let defaultSuggestions: [SearchSuggestion] = [
"Freedom", "Linux", "Ethics", "Internet of Things",
"Security", "Lightning talks", "Climate", "Cryptography", "Encryption",
"Internet", "Software", "Hardware", "Cloud", "Networking",
"Privacy", "Mental health", "Accessibility",
"Artificial intelligence", "AI", "Machine learning", "Neural networks", "Language models",
"Electronics", "Robotics", "Quantum computing", "Microcontroller",
"Python", "Rust",
"Science", "Chemistry", "Math", "Physics", "Biology", "Biohacking", "DNA", "Biometrics",
"Information theory", "Communication", "GPS",
"The ultimate talk", "Radio communications", "Badge",
"Blockchain", "Cryptocurrency",
"Digital forensics",
"Drones", "Autonomous vehicles", "Smart cities",
"Cybersecurity", "Digital rights", "Ethical hacking", "Data Science",
"Internet governance", "Hacktivism",
"Open source", "Free software",
"Malware analysis", "Data protection", "Forensics", "Social engineering",
"Network security",
"Virtual reality (VR)", "Augmented reality (AR)", "Wearable tech",
"Penetration testing", "Bug bounties", "Reverse engineering",
"Dark web", "Anonymity",
"4G", "5G", "Cellular",
].map(SearchSuggestion.init)
static let defaultSuggestions: [SearchSuggestion] = {
guard let url = Bundle.main.url(forResource: "SearchSuggestions", withExtension: "json5"),
let data = try? Data(contentsOf: url)
else { return [] }
let decoder = JSONDecoder()
decoder.allowsJSON5 = true
guard let titles = try? decoder.decode([String].self, from: data) else { return [] }
return titles.map(SearchSuggestion.init)
}()
}
51 changes: 51 additions & 0 deletions HackerTube/Features/Search/SearchSuggestions.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[
// Hacking & security
"Security", "Cybersecurity", "Ethical hacking", "Penetration testing",
"Cryptography", "Encryption", "Post-quantum cryptography",
"Privacy", "Anonymity", "Data protection", "Surveillance", "Spyware",
"Malware analysis", "Digital forensics", "Social engineering",
"Reverse engineering", "Fuzzing", "Side-channel attacks",
"Certificate transparency", "Passkeys", "WebAuthn",
"Secure boot", "Bootloader", "CTF",

// Systems & infrastructure
"Linux", "NixOS", "Containers", "Kubernetes",
"Cloud", "Self-hosting", "Internet", "Networking",
"IPv6", "BGP", "DNS", "DNSSEC", "eBPF", "VPN",
"4G", "5G", "Cellular", "LoRa",

// AI & data
"Artificial intelligence", "AI", "Machine learning", "Neural networks",
"Language models", "Large language models", "RAG", "AI agents",
"Data Science",

// Hardware & making
"Electronics", "Hardware", "Microcontroller", "FPGA", "Embedded systems",
"ESP32", "Raspberry Pi", "3D printing", "Laser",
"Robotics", "Drones", "Autonomous vehicles",
"Wearable tech", "Virtual reality (VR)", "Augmented reality (AR)",
"Quantum computing", "Amateur radio", "Internet of Things",

// Programming
"Software", "Open source", "Free software",
"Python", "Rust", "Go", "Haskell",

// Communications & protocols
"Matrix", "Fediverse", "Signal", "Meshtastic", "Meshcore",
"End-to-end encryption", "Federated", "Decentralized",

// Society, politics & law
"Freedom", "Ethics", "Digital sovereignty", "Digital rights",
"Internet governance", "Hacktivism", "Elections",
"Chat control", "E-voting", "Surveillance capitalism",
"Climate", "Mental health", "Accessibility",

// Science & space
"Science", "Chemistry", "Math", "Physics", "Biology",
"Biohacking", "DNA", "Biometrics",
"Information theory", "GPS", "Satellites",

// Community & culture
"Lightning talks", "The ultimate talk", "Badge", "Radio communications",
"OpenStreetMap", "Game development", "Godot", "Infrastructure review"
]
2 changes: 1 addition & 1 deletion HackerTube/Features/Search/SearchView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct SearchView: View {
@State var query = ""
@State var isLoading = false
@State var error: Error?
@State var suggestions: [SearchSuggestion] = SearchSuggestion.defaultSuggestions.shuffled()
@State var suggestions = SearchSuggestion.defaultSuggestions.shuffled().prefix(15)
@Environment(ApiService.self) var api

var body: some View {
Expand Down