Add DRM Check

This commit is contained in:
Stossy11 2024-12-07 15:02:02 +11:00
parent 531446a6ce
commit ddcb7a8f77
4 changed files with 48 additions and 2 deletions

View File

@ -15,8 +15,8 @@
filePath = "MeloNX/MeloNXApp.swift" filePath = "MeloNX/MeloNXApp.swift"
startingColumnNumber = "9223372036854775807" startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807"
startingLineNumber = "14" startingLineNumber = "21"
endingLineNumber = "14" endingLineNumber = "21"
landmarkName = "body" landmarkName = "body"
landmarkType = "24"> landmarkType = "24">
<Actions> <Actions>

View File

@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>MeloID</key>
<string>ipad</string>
<key>UIFileSharingEnabled</key> <key>UIFileSharingEnabled</key>
<true/> <true/>
</dict> </dict>

View File

@ -9,9 +9,53 @@ import SwiftUI
@main @main
struct MeloNXApp: App { struct MeloNXApp: App {
init() {
DispatchQueue.main.async {
drmcheck()
}
}
var body: some Scene { var body: some Scene {
WindowGroup { WindowGroup {
ContentView() 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)
}
}