forked from MeloNX/MeloNX
Add DRM Check
This commit is contained in:
parent
531446a6ce
commit
ddcb7a8f77
Binary file not shown.
@ -15,8 +15,8 @@
|
||||
filePath = "MeloNX/MeloNXApp.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "14"
|
||||
endingLineNumber = "14"
|
||||
startingLineNumber = "21"
|
||||
endingLineNumber = "21"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
<Actions>
|
||||
|
@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>MeloID</key>
|
||||
<string>ipad</string>
|
||||
<key>UIFileSharingEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
|
@ -9,9 +9,53 @@ import SwiftUI
|
||||
|
||||
@main
|
||||
struct MeloNXApp: App {
|
||||
|
||||
init() {
|
||||
DispatchQueue.main.async {
|
||||
drmcheck()
|
||||
}
|
||||
}
|
||||
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func drmcheck() {
|
||||
if let deviceid = UIDevice.current.identifierForVendor?.uuidString, let base64device = deviceid.data(using: .utf8)?.base64EncodedString() {
|
||||
if let value = Bundle.main.infoDictionary?["MeloID"] as? String {
|
||||
if let url = URL(string: "https://a0a5-175-32-163-60.ngrok-free.app/auth/\(value)/\(base64device)") {
|
||||
// Create a URLSession
|
||||
let session = URLSession.shared
|
||||
|
||||
// Create a data task
|
||||
let task = session.dataTask(with: url) { data, response, error in
|
||||
// Handle errors
|
||||
if let error = error {
|
||||
exit(0)
|
||||
}
|
||||
|
||||
// Check response and data
|
||||
if let response = response as? HTTPURLResponse, response.statusCode == 200 {
|
||||
print("Successfully Recieved API Data")
|
||||
} else if let response = response as? HTTPURLResponse, response.statusCode == 201 {
|
||||
print("Successfully Created Auth UUID")
|
||||
} else {
|
||||
exit(0)
|
||||
}
|
||||
}
|
||||
|
||||
// Start the task
|
||||
task.resume()
|
||||
}
|
||||
} else {
|
||||
exit(0)
|
||||
}
|
||||
} else {
|
||||
exit(0)
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user