Remote addons

Remote addons

av David Scotson -
Antall svar: 5
Hi all, I'm trying to develop of a remote addon using the new functionality in 3.1.

I've found one existing plugin that supports this, mod_certificate, though both it and my plugin seem to be hitting a similar issue, where the app downloads the addon (I can see a GET request for /mod/certificate/mobile/mod_certificate.zip) but nothing seems different in the app, and it still requires me to visit the website for certificates. I tried with both Android and iOS.

Could someone explain how you would debug this? Is there somewhere I can look within the app to see what errors may have been produced when it installed the addon etc.
Gjennomsnittlig vurdering: -
Som svar til David Scotson

Re: Remote addons

av David Scotson -
One error that I see at roughly the same time is regarding Cross-Origin Policy blocking the download of the user image. Is that expected? I see the warning but it doesn't seem to actually block the download. Would that be enough for the downloads of remote addons to be aborted at the same time?

11/7/2016 5:47:55 PM $mmWS: WS: Data received from WS objectionic.bundle.js:26771:18
"11/7/2016 5:47:55 PM mmExternalContent: Using URL http://joule2.dev/webservice/pluginfile.php/24/user/icon/clean/f1?rev=1&token=ec17d395257607d3bd0fb583b24dc4ad for http://joule2.dev/pluginfile.php/24/user/icon/clean/f1?rev=1"ionic.bundle.js:26771:18
11/7/2016 5:47:55 PM $mmFilepool: Set status 'notdownloaded' for package mmAddonManager mod_certificate_mod_certificateionic.bundle.js:26771:18
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://joule2.dev/webservice/pluginfile.php/24/user/icon/clean/f1?rev=1&token=ec17d395257607d3bd0fb583b24dc4ad. (Reason: CORS header 'Access-Control-Allow-Origin' missing).(unknown)
11/7/2016 5:47:56 PM $mmEvents: Event filepool_package_status_changed triggered.ionic.bundle.js:26771:18
11/7/2016 5:47:56 PM $mmEvents: Event section_status_changed triggered.ionic.bundle.js:26771:18
11/7/2016 5:47:56 PM $mmFilepool: Set status 'notdownloaded' for package mmAddonManager mod_certificate_mod_certificate
Som svar til David Scotson

Re: Remote addons

av Juan Leyva -
Bilde av Core developers Bilde av Moodle HQ Bilde av Particularly helpful Moodlers Bilde av Plugin developers Bilde av Testers

Hi,

are you launching your Chrome or Chormium with correct flags? Please, review

https://docs.moodle.org/dev/Moodle_Mobile_development_using_Chrome_or_Chromium

Juan

Som svar til Juan Leyva

Re: Remote addons

av David Scotson -
Hi Juan, thanks for the help, after eliminating that possibility I think I got to the bottom of what was going wrong.

It seems like the  gulp remoteaddon bundling step might grab .js test files and concatenate them with the rest of the js in addon.js, it was then complaining about the 'describe' function used in the test file on load.

Not sure if that's a bug in the gulp step or I'm just doing something wrong, but for now deleting the file gets me to the point where the remote addon loads and works 99% and I can debug the rest.

edit: oh and when one addon errors, it stops installation of all of them it seems, so I needed to test the two remote addons seperately. When I did that the mod certificate one worked fine.
Som svar til David Scotson

Re: Remote addons

av David Scotson -

So a final issue I've hit and can't figure out:

Error: [$sce:insecurl] Blocked loading resource from url not allowed by $sceDelegate policy.  URL: filesystem:http://localhost:8100/persistent/sites/05af9b4d326c0f5d15bcfd9a026aee74/filepool/remoteaddons/mod_hsuforum_mod_hsuforum/templates/discussionpost.html

The template url for a delegate is triggering a security exception when used as part of a remote addon, but the exact same code when used as a core addon works fine. I would have thought that something coming from within the app wouldn't trigger such a security issue, but then I guess when it's a remote addon then it's not technically part of the app since it's getting downloaded.

The docs only say that the same port, domain and protocol are required, which I think is the case here. But it also talks about whitelists and blacklists so perhaps this is hitting a blacklist?

I'm not really familiar enough with Ionic etc. to know how I should proceed here. Do you know if this is supported in remote addons, and what I would need to do to make this work if it is?