Thu, 18 Mar 2021 08:35:37 GMT
Join the conversation at slack.cordova.io
Wed, 17 Mar 2021 15:10:46 GMT
@osaintilien55 says
In my Chrome Remote Debug I see this error
DevTools failed to load SourceMap: Could not load content for file:///android_asset/www/dist/bundle.js.map:
However I can clearly see the actual file in question in my folder in the right place, If the app recognizes my bundle.js shouldn't it recognize the map also since there in same directory? Source maps is enabled in Chrome preferences
Wed, 17 Mar 2021 15:25:26 GMT
@timbru says
No, depends how the sourceMappingURL is defined in the .js file 😉
Wed, 17 Mar 2021 15:29:27 GMT
@osaintilien55 says
Ah okay will look into that
Wed, 17 Mar 2021 15:38:06 GMT
@timbru says
There were some quirks with the Ionic WebView IIRC - I couldn’t get it to work either
Wed, 17 Mar 2021 15:43:28 GMT
@osaintilien55 says
Hmm and you use webpack? I'm seeing there is a plugin called SourceMapDevToolPlugin for webpack, hoping this will help.
Wed, 17 Mar 2021 15:45:23 GMT
@timbru says
Under the hood, yes (Angular)
Wed, 17 Mar 2021 15:45:33 GMT
@osaintilien55 says
Ah okay
Wed, 17 Mar 2021 15:52:10 GMT
@norman137 says
SourceMapDevToolPlugin
is used by webpack behind the scenes when you use thedevtool
configuration. Using the plugin directly will expose more advanced options though.I use
devtool: 'inline-source-map',
for my debug builds for source maps.
Wed, 17 Mar 2021 16:42:52 GMT
@osaintilien55 says
Wow such a simple fix! I had it set to just source-map, but inline-source-map made the difference
Wed, 17 Mar 2021 19:47:38 GMT
@algotech says
hello everyone
Wed, 17 Mar 2021 19:48:55 GMT
@algotech says
I did an ios/android app which is almost finished. And I would like to “protect” somehow the code and data
Wed, 17 Mar 2021 19:49:32 GMT
@algotech says
are there good tools to “encrypt” (obfuscate) my js ?
Wed, 17 Mar 2021 19:50:53 GMT
@algotech says
or maybe, a way to encrypt ? (using native code with a secret key) ?
Wed, 17 Mar 2021 19:51:21 GMT
@algotech says
thank you for your answers 🙂
Wed, 17 Mar 2021 19:57:59 GMT
@norman137 says
not really -- the browser runs an interpret language, so it at some point needs to decrypt your code in order to run and understand it.
Any solution that runs on the client can be reversed engineered.
If you have secrets that you want to keep safe, don‘t put them in the app. Instead put the software on a server with an API that your app can call. That’s why cloud-based Software as a Service is so popular these days.
Wed, 17 Mar 2021 20:03:36 GMT
@norman137 says
Btw this isn't a problem exclusive to Cordova apps either. Native iOS apps written in both objective-c or swift can also be reversed engineered, as with Android apps written in Java.
Wed, 17 Mar 2021 22:21:32 GMT
@algotech says
hum
Wed, 17 Mar 2021 22:21:58 GMT
@algotech says
maybe something that makes js very hard to read at least ?
Wed, 17 Mar 2021 22:31:18 GMT
@norman137 says
Lots of minification libraries out there -- they'll strip out comments, replace variable names with single letter names. Usually they make aliases so that they can replace
document.getElementByID
with something shorter for example... In general strings are left untouched however. Most bundles like webpack has some libraries built in out there.There are probably obfuscation libraries out there as well, that would replace strings with some executable code that would produce an equivalent string output when ran, just won't be obvious unless you actually copy/execute the code in a JS environment.
Security by obscurity is a really bad habit though...
Wed, 17 Mar 2021 22:32:21 GMT
@algotech says
I agree 🙂
Wed, 17 Mar 2021 22:32:43 GMT
@algotech says
but it seams that we don't have the choice with Cordova
Wed, 17 Mar 2021 22:33:02 GMT
@algotech says
my data is on a server
Wed, 17 Mar 2021 22:34:00 GMT
@algotech says
but if the code to get data is in clear, the problem remains
Wed, 17 Mar 2021 22:34:49 GMT
@norman137 says
Sound‘s like you’re missing an access control layer 😉
Wed, 17 Mar 2021 22:38:01 GMT
@algotech says
yes
Wed, 17 Mar 2021 22:38:32 GMT
@algotech says
I should put the flow on paper
Wed, 17 Mar 2021 22:38:53 GMT
@algotech says
and mark the sensitive areas
Wed, 17 Mar 2021 22:41:43 GMT
@algotech says
thank you @norman137
Wed, 17 Mar 2021 20:05:15 GMT
@mathewp.94 says
Be careful when updating Android Studio, version 4+ seems to break builds for my app, downgraded to version 3.6.3 and got things working again.
Wed, 17 Mar 2021 20:37:05 GMT
@jalidjinou says
Hi. I cannot build android app anymore but it keeps working for ios.
Wed, 17 Mar 2021 10:23:30 GMT
@lonestarx91 says
if anyone could throw a thought, i'd greatly appreciate it
Wed, 17 Mar 2021 10:24:02 GMT
@lonestarx91 says
myplugin.getStuff(*function*(success){
     Âconsole.log('weee');
   Â});
Wed, 17 Mar 2021 10:24:42 GMT
@lonestarx91 says
where getStuff is declared
getStuff: *function* (success) {
   Âcordova.exec(*function* (result) {}, *function* (error) {}, "myplugin", "getStuff", []);
 Â}
Wed, 17 Mar 2021 10:24:49 GMT
@lonestarx91 says
the log is never executed
Wed, 17 Mar 2021 10:25:04 GMT
@lonestarx91 says
but the native code is called
Wed, 17 Mar 2021 10:26:18 GMT
@lonestarx91 says
in the native code i tried returning all kinds of message, from bool to array, string etc, nothing seems to satisfy it
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:YES];
 Â[*self*.commandDelegate sendPluginResult:result callbackId:command.callbackId];
Wed, 17 Mar 2021 10:31:15 GMT
@timbru says
Like I’ve said yesterday, it would help if you can actually show the real code snippets. Again your example doesn’t make sense:
cordova.exec(*function* (result) {}
- your success function is an empty function?!
Wed, 17 Mar 2021 10:42:46 GMT
@lonestarx91 says
umm it‘s not an example, it’s actually what i use
Wed, 17 Mar 2021 10:42:53 GMT
@lonestarx91 says
i tried following https://stackoverflow.com/questions/32427219/how-can-i-return-a-string-from-a-cordova-custom-plugin for example
Wed, 17 Mar 2021 10:42:59 GMT
@lonestarx91 says
and i don't get the string returned either
Wed, 17 Mar 2021 10:43:20 GMT
@lonestarx91 says
where it says to call
MyPlugin.myAction(success, error);
Wed, 17 Mar 2021 10:43:26 GMT
@lonestarx91 says
it's never returning
Wed, 17 Mar 2021 10:43:54 GMT
@lonestarx91 says
sorry @timbru if i seem dull, it‘s just i’m very newbie with cordova
Wed, 17 Mar 2021 10:45:17 GMT
@lonestarx91 says
i take it my success function is supposed to have something ?
Wed, 17 Mar 2021 10:46:12 GMT
@lonestarx91 says
my end goal is to return a json array (string or nsarray or whichever works) from the native code to the js
Wed, 17 Mar 2021 10:46:40 GMT
@lonestarx91 says
I understand i can do that via
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:jsonString];
 Â[*self*.commandDelegate sendPluginResult:result callbackId:command.callbackId];
Wed, 17 Mar 2021 10:46:46 GMT
@lonestarx91 says
i just have no idea what's wrong in the js part
Wed, 17 Mar 2021 10:51:38 GMT
@lonestarx91 says
myAction: *function*(success, error){
   Âcordova.exec(success, error, "MyPlugin", "myAction", []);
 Â}
MyPlugin.myAction(success, error);
*function* success(myString){
 Âconsole.log(myString);
}
*function* error(error){
 Âconsole.log(JSON.stringify(error));
}
- (*void*) myAction:(CDVInvokedUrlCommand*)command {
 ÂNSString* myString = @"Some string";
 ÂCDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:myString];
 Â[*self*.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
for instance, this doesn't work...
Wed, 17 Mar 2021 10:54:50 GMT
@lonestarx91 says
- (*void*) myAction:(CDVInvokedUrlCommand*)command
- the native code IS called but the log (success func) is not
Wed, 17 Mar 2021 11:25:31 GMT
@lonestarx91 says
aaand solved, nevermind
Wed, 17 Mar 2021 11:25:45 GMT
@lonestarx91 says
self.commandDelegate was sending the result to the wrong webview