mirror of
https://github.com/lux-tel/session-ios.git
synced 2026-10-30 20:38:32 +00:00
• Wired up the dev settings • Update logic to use an ed25519 key for the FileServer instead of an x25519 one • Updated the ReuploadUserDisplayPictureJob to wait for the first poll to succeed before running (to reduce config conflict issues) • Fixed a bug with the FileServer extend API call
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
// Copyright © 2025 Rangeproof Pty Ltd. All rights reserved.
|
|
|
|
import Foundation
|
|
|
|
public extension URL {
|
|
var strippingQueryAndFragment: URL? {
|
|
guard var components: URLComponents = URLComponents(url: self, resolvingAgainstBaseURL: false) else {
|
|
return nil
|
|
}
|
|
components.queryItems = nil
|
|
components.fragment = nil
|
|
|
|
return components.url
|
|
}
|
|
|
|
var queryParameters: [HTTPQueryParam: String] {
|
|
guard
|
|
let components: URLComponents = URLComponents(url: self, resolvingAgainstBaseURL: false),
|
|
let queryItems: [URLQueryItem] = components.queryItems
|
|
else { return [:] }
|
|
|
|
return queryItems.reduce(into: [:]) { result, next in
|
|
result[HTTPQueryParam(next.name)] = (next.value ?? "")
|
|
}
|
|
}
|
|
|
|
var fragmentParameters: [HTTPFragmentParam: String] {
|
|
guard let fragment = self.fragment else { return [:] }
|
|
|
|
// Parse fragment as if it were a query string
|
|
var components: URLComponents = URLComponents()
|
|
components.query = fragment
|
|
|
|
guard let queryItems: [URLQueryItem] = components.queryItems else { return [:] }
|
|
|
|
return queryItems.reduce(into: [:]) { result, next in
|
|
result[HTTPFragmentParam(next.name)] = (next.value ?? "")
|
|
}
|
|
}
|
|
}
|