@@ -132,6 +132,7 @@ class Injector: ObservableObject {
132
132
guard let injectDetail = injectConfiguration. injectDetail ( package : package ) else {
133
133
return
134
134
}
135
+ print ( " [*] Start inject \( package ) " )
135
136
self . injectDetail = injectDetail
136
137
self . appDetail = appDetail
137
138
self . shouldShowStatusSheet = true
@@ -326,7 +327,7 @@ class Injector: ObservableObject {
326
327
case . none:
327
328
return path. replacingOccurrences ( of: " %20 " , with: " " )
328
329
case . appleScript:
329
- return path. replacingOccurrences ( of: " %20 " , with: " " ) . replacingOccurrences ( of: " " , with: " \\ \\ " )
330
+ return path. replacingOccurrences ( of: " %20 " , with: " " ) . replacingOccurrences ( of: " " , with: " \\ \\ " )
330
331
case . bash:
331
332
return path. replacingOccurrences ( of: " %20 " , with: " " ) . replacingOccurrences ( of: " " , with: " \\ " )
332
333
}
@@ -340,29 +341,29 @@ class Injector: ObservableObject {
340
341
341
342
if !FileManager. default. fileExists ( atPath: source) {
342
343
print ( " Source file not found: \( source) " )
343
- return [ ( " echo Source file not found: \( source. transformTo ( to: . appleScript ) ) && exit 1 " , true ) ] // 借用一下 AppleScript 来弹窗
344
+ return [ ( " echo Source file not found: \( source. transformTo ( to: . bash ) ) && exit 1 " , true ) ] // 借用一下 AppleScript 来弹窗
344
345
}
345
346
if FileManager . default. fileExists ( atPath: destination) {
346
347
print ( " Destination file already exists: \( destination) " )
347
348
return [ ]
348
349
}
349
350
return [
350
- ( " sudo cp \( source. transformTo ( to: . appleScript ) ) \( destination. transformTo ( to: . appleScript ) ) " , true )
351
+ ( " sudo cp \( source. transformTo ( to: . bash ) ) \( destination. transformTo ( to: . bash ) ) " , true )
351
352
]
352
353
}
353
354
354
355
// MARK: - 注入原神之 权限与运行检查
355
356
356
357
func checkPermissionAndRunCommands( ) -> [ ( command: String , isAdmin: Bool ) ] {
357
358
var shells : [ ( command: String , isAdmin: Bool ) ] = [ ]
358
- let source = self . genSourcePath ( for: . appleScript )
359
+ let source = self . genSourcePath ( for: . bash )
359
360
shells. append ( ( " sudo xattr -cr \( source) " , true ) )
360
361
shells. append ( ( " sudo chmod -R 777 \( source) " , true ) )
361
362
362
363
// 检查是否运行中, 如果运行中则杀掉进程
363
364
let isRunning = NSRunningApplication . runningApplications ( withBundleIdentifier: self . appDetail? . identifier ?? " " ) . count > 0
364
365
if isRunning {
365
- shells. append ( ( " sudo pkill -f \( self . genSourcePath ( for: . appleScript , executable: true ) ) " , true ) )
366
+ shells. append ( ( " sudo pkill -f \( self . genSourcePath ( for: . bash , executable: true ) ) " , true ) )
366
367
}
367
368
return shells
368
369
}
@@ -410,12 +411,12 @@ class Injector: ObservableObject {
410
411
let componentApp = componentAppList. map { appBaseLocate + $0 }
411
412
let componentAppExecutable = componentApp. map { $0 + " /Contents/MacOS/ " + ( self . readExecutableFile ( app: URL ( fileURLWithPath: $0) ) ?? " " ) }
412
413
let desireAppList = desireApp + componentAppExecutable
413
- let insert_dylib_commands = desireAppList. map { " sudo \( self . genSourcePath ( for: . appleScript , path: insert_dylib_URL!) ) ' \( copyedQiuchenly_URL) ' ' \( destination. transformTo ( to: . none) ) ' ' \( $0) ' " }
414
+ let insert_dylib_commands = desireAppList. map { " sudo \( self . genSourcePath ( for: . bash , path: insert_dylib_URL!) ) ' \( copyedQiuchenly_URL) ' ' \( destination. transformTo ( to: . none) ) ' ' \( $0) ' " }
414
415
415
416
return [ softLink] + insert_dylib_commands. map { ( $0, true ) }
416
417
}
417
418
418
- return [ ( " sudo \( self . genSourcePath ( for: . appleScript , path: insert_dylib_URL!) ) ' \( QiuchenlyDylib_URL!) ' ' \( source. transformTo ( to: . none) ) ' ' \( destination. transformTo ( to: . none) ) ' " , true ) ]
419
+ return [ ( " sudo \( self . genSourcePath ( for: . bash , path: insert_dylib_URL!) ) ' \( QiuchenlyDylib_URL!) ' ' \( source. transformTo ( to: . none) ) ' ' \( destination. transformTo ( to: . none) ) ' " , true ) ]
419
420
}
420
421
421
422
// MARK: - 注入原神之 DeepCodeSign
@@ -483,29 +484,29 @@ class Injector: ObservableObject {
483
484
let downloadPath = downloadIntoTmpPath. appendingPathComponent ( extraShell) . path
484
485
let downloadCommand = " curl -L -o \( downloadPath) \( getToolDownloadURL) "
485
486
486
- let dest = self . genSourcePath ( for: . appleScript )
487
+ let dest = self . genSourcePath ( for: . bash )
487
488
488
489
// MARK: - Sub: 对某些 shell 脚本进行内容替换
489
490
490
491
var replaceSpecialShell : [ ( String , String ) ] = [ ] // (from, to)
491
492
492
493
// tool/optool
493
- let optoolPath = self . genSourcePath ( for: . appleScript , path: injectConfiguration. getInjecToolPath ( name: " optool " ) ? . pathWithFallback ( ) )
494
+ let optoolPath = self . genSourcePath ( for: . bash , path: injectConfiguration. getInjecToolPath ( name: " optool " ) ? . pathWithFallback ( ) )
494
495
replaceSpecialShell. append ( ( " tool/optool " , optoolPath) )
495
496
replaceSpecialShell. append ( ( " ./tool/optool " , optoolPath) )
496
497
497
498
// tool/insert_dylib
498
- let insert_dylibPath = self . genSourcePath ( for: . appleScript , path: injectConfiguration. getInjecToolPath ( name: " insert_dylib " ) ? . pathWithFallback ( ) )
499
+ let insert_dylibPath = self . genSourcePath ( for: . bash , path: injectConfiguration. getInjecToolPath ( name: " insert_dylib " ) ? . pathWithFallback ( ) )
499
500
replaceSpecialShell. append ( ( " tool/insert_dylib " , insert_dylibPath) )
500
501
replaceSpecialShell. append ( ( " ./tool/insert_dylib " , insert_dylibPath) )
501
502
502
503
// tool/91QiuChenly.dylib
503
- let dylibPath = self . genSourcePath ( for: . appleScript , path: injectConfiguration. getInjecToolPath ( name: " 91Qiuchenly.dylib " ) ? . pathWithFallback ( ) )
504
+ let dylibPath = self . genSourcePath ( for: . bash , path: injectConfiguration. getInjecToolPath ( name: " 91Qiuchenly.dylib " ) ? . pathWithFallback ( ) )
504
505
replaceSpecialShell. append ( ( " tool/91QiuChenly.dylib " , dylibPath) )
505
506
replaceSpecialShell. append ( ( " ./tool/91QiuChenly.dylib " , dylibPath) )
506
507
507
508
// tool/GenShineImpactStarter
508
- let genShineImpactStarterPath = self . genSourcePath ( for: . appleScript , path: injectConfiguration. getInjecToolPath ( name: " GenShineImpactStarter " ) ? . pathWithFallback ( ) )
509
+ let genShineImpactStarterPath = self . genSourcePath ( for: . bash , path: injectConfiguration. getInjecToolPath ( name: " GenShineImpactStarter " ) ? . pathWithFallback ( ) )
509
510
replaceSpecialShell. append ( ( " tool/GenShineImpactStarter " , genShineImpactStarterPath) )
510
511
replaceSpecialShell. append ( ( " ./tool/GenShineImpactStarter " , genShineImpactStarterPath) )
511
512
@@ -541,7 +542,7 @@ class Injector: ObservableObject {
541
542
let bridgeFile = ( self . appDetail? . path ?? " " ) + ( self . getBridgeDir ( ) )
542
543
let insertDylibURL = self . genSourcePath ( for: . bash, path: injectConfiguration. getInjecToolPath ( name: " insert_dylib " ) ? . pathWithFallback ( ) )
543
544
let helperName = targetHelper. split ( separator: " / " ) . last
544
- let target = self . genSourcePath ( for: . appleScript , path: " /Library/LaunchDaemons/ \( helperName!) .plist " )
545
+ let target = self . genSourcePath ( for: . bash , path: " /Library/LaunchDaemons/ \( helperName!) .plist " )
545
546
546
547
var srcInfo = [ ( self . appDetail? . path ?? " " ) . replacingOccurrences ( of: " /Contents " , with: " " ) + " /Contents/Info.plist " ]
547
548
if let componentApps = self . injectDetail? . componentApp {
0 commit comments