{"id":19592126,"url":"https://github.com/catalyst/moodle-mod_applaunch","last_synced_at":"2025-02-26T14:14:44.484Z","repository":{"id":48575449,"uuid":"371580949","full_name":"catalyst/moodle-mod_applaunch","owner":"catalyst","description":"A moodle activity plugin to manage launching an external application.","archived":false,"fork":false,"pushed_at":"2022-09-05T06:59:53.000Z","size":103,"stargazers_count":0,"open_issues_count":13,"forks_count":2,"subscribers_count":20,"default_branch":"main","last_synced_at":"2025-01-09T06:47:40.253Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/catalyst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-05-28T04:37:32.000Z","updated_at":"2023-02-06T10:43:46.000Z","dependencies_parsed_at":"2023-01-17T20:30:44.932Z","dependency_job_id":null,"html_url":"https://github.com/catalyst/moodle-mod_applaunch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-mod_applaunch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-mod_applaunch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-mod_applaunch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/catalyst%2Fmoodle-mod_applaunch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/catalyst","download_url":"https://codeload.github.com/catalyst/moodle-mod_applaunch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240867427,"owners_count":19870405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T08:33:18.772Z","updated_at":"2025-02-26T14:14:44.415Z","avatar_url":"https://github.com/catalyst.png","language":"PHP","readme":"# moodle-mod_applaunch\n![GitHub Workflow Status (branch)](https://img.shields.io/github/workflow/status/catalyst/moodle-mod_applaunch/ci/main?label=ci)\n\nA moodle activity plugin to manage launching an external applications.\n\nThe administrator can define multiple different types of applications and these will show\nin the activity chooser with their own icons and names, similar to the way LTI plugin.\n\n\nBranches\n--------\n\n| Moodle verion     | Branch           | PHP  |\n| ----------------- | ---------------- | ---- |\n| Moodle 3.9+       | MOODLE_39_STABLE | 7.1+ |\n| Totara up to 11   | MOODLE_39_STABLE | 7.1+ |\n\n\nSetup\n--------\n\nThe `webservice/{name}:use` capability for all users that are using this plugin. As a catch all method, you can enable this capability for the *Authenticated user* role. If you require less access to this capability, you could create a new role based on the student archetype with this capability enabled. New users could then be enrolled in the course containing the applaunch activity with new role.\n\nTo create or modify a role, go to `Site administration` -\u003e `Users` -\u003e `Define roles`.\n\nIf using the rest protocol, the capability would be called `webservice/rest:user`.\n\nYou will also need to enable and configure web services, including the protocols required such as REST. https://docs.moodle.org/en/Using_web_services\n\nConfiguring an application schema\n--------------------------------\n\n1) Lets assume your desktop app has a schema of 'foobar://'\n2) Navigate to Admin \u003e Plugins \u003e Activities \u003e App Launcher \u003e Manage app types\n3) Create or edit an app type. Under 'URL', add the schema with any part of the url that would be used by any course. E.g. 'foobar://activity.run'\n4) Go to a course, and create or edit an applauncher activity with the same app type. Under 'URL slug', and a string to be appended to the url that is specific for the course. This is options. E.g. '/course/123\n\n\nThe url scheme interface\n------------------------\n\nWhen a learner clicks on a link to open your app it will pass through two query params:\n\n```\nfoobar://test.com?token=xxxx\u0026baseuri=https%3A%2F%2Fmoodle.example.edu,\n```\n\n1) token - This is a single use token which the app must exchange in order to gain a normal Moodle Webservice token\n2) baseuri - This is the wwwroot of the Moodle instance that launched the app, which MUST be used for all communication back to Moodle. Note that the value will be URL escaped\n\nExchange single use token for WS key\n------------------------------------\n\nTo exchange the single use token make a GET request like this:\n\n```\n[baseuri]mod/applaunch/token.php?token=xxxxx\n```\n\nThis will return a json document\n\n```json\n{\n    \"wstoken\": \"xxxxx\",\n    \"errors\": \"\",\n    \"baseurl\": \"https://moodle.example.edu\",\n    \"activityslug\": \"/mod/applaunch/view.php?id=1234\"\n}\n```\n\nMark as complete using Moodle webservice\n----------------------------------------\n\nLook at the Moodle docs regarding the protocol that is being used for a more detailed outline of how to make a web service request to Moodle. An example for the REST protocol will be provided below. The key bits of information you need are:\n\n* wstoken: [provided in json from token.php]\n* wsfunction: mod_applaunch_complete_activity\n* activityslug: [provided in json from token.php]\n\nRest example:\nMust use the POST protocol.\n\n```sh\ncurl -d \"wstoken=value1\u0026wsfunction=mod_applaunch_complete_activity\u0026moodlewsrestformat=json\u0026activityslug=value2\" -X POST https://www.moodle.com/webservice/rest/server.php\n```\nCalling this endpoint with the external function `archivecompletion` will mark the activity as complete for the user who clicked the launch button.\n\nOn a success you will receieve (if JSON is selected for return format)\n\n```json\n{\"success\": \"true\"}\n```\n\nIf there is a failure, the format of the response will be:\n\n```json\n{\n    \"exception\": \"dml_missing_record_exception\",\n    \"errorcode\": \"invalidrecordunknown\",\n    \"message\": \"An error message\",\n    \"debuginfo\": \"Extra debug info\"\n}\n```\n\nA reference implementation\n--------------------------\n\nA reference implementation has been bundled as a standalone php CLI script which implements the single use token\nexchange and the callback to the Moodle webservice to mark the activity as complete.\n\nThis can be configured\n\n### Ubuntu / Linux\n\nTo setup a new custom url schema TBA\n\nThis guide can be followed to set up a specific app or script to be run, when a custom schema is detected.\n\nhttps://unix.stackexchange.com/questions/497146/create-a-custom-url-protocol-handler\n\n\n### Windows\n\nTBA\n\n\nSupport\n-------\n\nIf you have issues please log them in github here\n\nhttps://github.com/catalyst/moodle-mod_applaunch/issues\n\nPlease note our time is limited, so if you need urgent support or want to\nsponsor a new feature then please contact Catalyst IT Australia:\n\nhttps://www.catalyst-au.net/contact-us\n\n\nCredits\n-------\n\nThis plugin was developed by Catalyst IT Australia:\n\nhttps://www.catalyst-au.net/\n\n\u003cimg alt=\"Catalyst IT\" src=\"https://cdn.rawgit.com/CatalystIT-AU/moodle-auth_saml2/master/pix/catalyst-logo.svg\" width=\"400\"\u003e\n\nActivity Icon: Icons made by [Freepik](https://www.freepik.com \"Freepik\") from [www.flaticon.com](https://www.flaticon.com/ \"Flaticon\")\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalyst%2Fmoodle-mod_applaunch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatalyst%2Fmoodle-mod_applaunch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatalyst%2Fmoodle-mod_applaunch/lists"}