Skip to content

Commit

Permalink
typo
Browse files Browse the repository at this point in the history
  • Loading branch information
雍鹏亮 committed Jul 10, 2020
1 parent 013b2d1 commit 0c8211d
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 25 deletions.
2 changes: 1 addition & 1 deletion MangoFix.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "MangoFix"
s.version = "1.4.2"
s.version = "1.4.3"
s.summary = "MangoFix"
s.description = <<-DESC
Mango is a DSL which syntax is very similar to Objective-C,Mango is also an iOS App hotfix SDK. You can use Mango method replace any Objective-C method.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion MangoFix/Compiler/AST/MFInterpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@

@property (strong, nonatomic) MFStack *stack;

- (void)compileSoruceWithString:(NSString *)source;
- (void)compileSourceWithString:(NSString *)source;

@end
2 changes: 1 addition & 1 deletion MangoFix/Compiler/AST/MFInterpreter.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ - (MFStack *)stack{
}


- (void)compileSoruceWithString:(NSString *)source{
- (void)compileSourceWithString:(NSString *)source{
extern void mf_set_source_string(char const *source);
mf_set_source_string([source UTF8String]);
extern void yyrestart (FILE * input_file );
Expand Down
12 changes: 6 additions & 6 deletions MangoFix/Execute/MFContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
@param privateKey RSA private key
@return MFContext instance
*/
- (instancetype)initWithRASPrivateKey:(NSString *)privateKey NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithRSAPrivateKey:(NSString *)privateKey NS_DESIGNATED_INITIALIZER;

- (instancetype)init NS_UNAVAILABLE;

/**
Evaluate MangoFix code that encrypted by RAS and base64 encode string from a url.
Evaluate MangoFix code that encrypted by RSA and base64 encode string from a url.
@param url The url of the MangoFix code that encrypted by RAS and base64 encode string.
@param url The url of the MangoFix code that encrypted by RSA and base64 encode string.
*/
- (void)evalMangoScriptWithURL:(NSURL *)url;

/**
Evaluate a data of MangoFix code that encrypted by RAS.
Evaluate a data of MangoFix code that encrypted by RSA.
@param rsaEncryptedBase64String of MangoFix code that encrypted by RAS.
@param rsaEncryptedBase64String of MangoFix code that encrypted by RSA.
*/
- (void)evalMangoScriptWithRASEncryptedBase64String:(NSString *)rsaEncryptedBase64String;
- (void)evalMangoScriptWithRSAEncryptedBase64String:(NSString *)rsaEncryptedBase64String;

/**
Get a particular property on the global object.
Expand Down
12 changes: 6 additions & 6 deletions MangoFix/Execute/MFContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ @interface MFContext()

@implementation MFContext

- (instancetype)initWithRASPrivateKey:(NSString *)privateKey{
- (instancetype)initWithRSAPrivateKey:(NSString *)privateKey{
if (self = [super init]) {
_interpreter = [[MFInterpreter alloc] init];
_privateKey = privateKey;
Expand All @@ -34,21 +34,21 @@ - (void)evalMangoScriptWithURL:(NSURL *)url{
NSLog(@"MangoFix: %@",error);
return;
}
[self evalMangoScriptWithRASEncryptedBase64String:rsaEncryptedBase64String];
[self evalMangoScriptWithRSAEncryptedBase64String:rsaEncryptedBase64String];

}
}

- (void)evalMangoScriptWithRASEncryptedBase64String:(NSString *)rsaEncryptedBase64String{
- (void)evalMangoScriptWithRSAEncryptedBase64String:(NSString *)rsaEncryptedBase64String{
@autoreleasepool {
NSString *mangoFixString = [MFRSA decryptString:rsaEncryptedBase64String privateKey:self.privateKey];
if (!mangoFixString.length) {
NSLog(@"MangoFix: RAS decrypt error!");
NSLog(@"MangoFix: RSA decrypt error!");
return;
}
mf_set_current_compile_util(self.interpreter);
mf_add_built_in(self.interpreter);
[self.interpreter compileSoruceWithString:mangoFixString];
[self.interpreter compileSourceWithString:mangoFixString];
mf_set_current_compile_util(nil);
mf_interpret(self.interpreter);
}
Expand All @@ -73,7 +73,7 @@ - (void)evalMangoScriptWithDebugURL:(NSURL *)url{
NSString *mangoFixString = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:&error];
mf_set_current_compile_util(self.interpreter);
mf_add_built_in(self.interpreter);
[self.interpreter compileSoruceWithString:mangoFixString];
[self.interpreter compileSourceWithString:mangoFixString];
mf_set_current_compile_util(nil);
mf_interpret(self.interpreter);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
6 changes: 3 additions & 3 deletions MangoFixDemo/MangoFixDemo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ - (BOOL)encryptPlainScirptToDocument{
BOOL writeResult = NO;

NSURL *scriptUrl = [[NSBundle mainBundle] URLForResource:@"demo" withExtension:@"mg"];
NSString *planScriptString = [NSString stringWithContentsOfURL:scriptUrl encoding:NSUTF8StringEncoding error:&outErr];
NSString *plainScriptString = [NSString stringWithContentsOfURL:scriptUrl encoding:NSUTF8StringEncoding error:&outErr];
if (outErr) goto err;

{
NSURL *publicKeyUrl = [[NSBundle mainBundle] URLForResource:@"public_key.txt" withExtension:nil];
NSString *publicKey = [NSString stringWithContentsOfURL:publicKeyUrl encoding:NSUTF8StringEncoding error:&outErr];
if (outErr) goto err;
NSString *encryptedScriptString = [MFRSA encryptString:planScriptString publicKey:publicKey];
NSString *encryptedScriptString = [MFRSA encryptString:plainScriptString publicKey:publicKey];

NSString * encryptedPath= [(NSString *)[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"encrypted_demo.mg"];
NSFileManager *fileManager = [NSFileManager defaultManager];
Expand All @@ -52,7 +52,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
NSURL *privateKeyUrl = [[NSBundle mainBundle] URLForResource:@"private_key.txt" withExtension:nil];
NSString *privateKey = [NSString stringWithContentsOfURL:privateKeyUrl encoding:NSUTF8StringEncoding error:nil];

MFContext *context = [[MFContext alloc] initWithRASPrivateKey:privateKey];
MFContext *context = [[MFContext alloc] initWithRSAPrivateKey:privateKey];

NSString * encryptedPath= [(NSString *)[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"encrypted_demo.mg"];
NSURL *scriptUrl = [NSURL fileURLWithPath:encryptedPath];
Expand Down
8 changes: 4 additions & 4 deletions MangoFixDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
PODS:
- MangoFix (1.4.1)
- MangoFix (1.4.3)
- Masonry (1.1.0)

DEPENDENCIES:
- MangoFix (from `../`)
- Masonry

SPEC REPOS:
trunk:
https://github.com/cocoapods/specs.git:
- Masonry

EXTERNAL SOURCES:
MangoFix:
:path: "../"

SPEC CHECKSUMS:
MangoFix: 973ab9e2cd5d0abef69cb5b62b5b9c3da23c7cd0
MangoFix: af9dfecba28bb8f4f4884c2c4f85abad8dd1c6ce
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201

PODFILE CHECKSUM: 911a1bb3fd9799c1577d16ea8d90314d90fb35f1

COCOAPODS: 1.9.1
COCOAPODS: 1.7.5
2 changes: 1 addition & 1 deletion MangoFixTests/MangoFixTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ - (void)loadMango:(NSString *)mangoName{


- (void)setUp {
self.context = [[MFContext alloc] initWithRASPrivateKey:nil];
self.context = [[MFContext alloc] initWithRSAPrivateKey:nil];
}


Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ MangoFix is a DSL which syntax is very similar to Objective-C,MangoFix is also
BOOL writeResult = NO;

NSURL *scriptUrl = [[NSBundle mainBundle] URLForResource:@"demo" withExtension:@"mg"];
NSString *planScriptString = [NSString stringWithContentsOfURL:scriptUrl encoding:NSUTF8StringEncoding error:&outErr];
NSString *plainScriptString = [NSString stringWithContentsOfURL:scriptUrl encoding:NSUTF8StringEncoding error:&outErr];
if (outErr) goto err;

{
NSURL *publicKeyUrl = [[NSBundle mainBundle] URLForResource:@"public_key.txt" withExtension:nil];
NSString *publicKey = [NSString stringWithContentsOfURL:publicKeyUrl encoding:NSUTF8StringEncoding error:&outErr];
if (outErr) goto err;
NSString *encryptedScriptString = [MFRSA encryptString:planScriptString publicKey:publicKey];
NSString *encryptedScriptString = [MFRSA encryptString:plainScriptString publicKey:publicKey];

NSString * encryptedPath= [(NSString *)[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:@"encrypted_demo.mg"];
NSFileManager *fileManager = [NSFileManager defaultManager];
Expand Down

0 comments on commit 0c8211d

Please sign in to comment.