From 4d643dd08eb8e6568b87dd492a9554dff49e975d Mon Sep 17 00:00:00 2001 From: Volodymyr Shymanskyy Date: Tue, 15 Oct 2024 22:04:59 +0300 Subject: [PATCH] Switch to emlearn index --- package-lock.json | 4 ++-- package.json | 2 +- src/package_mgr.js | 8 +++++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index 889359c..4621301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ViperIDE", - "version": "0.5.5", + "version": "0.5.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ViperIDE", - "version": "0.5.5", + "version": "0.5.6", "dependencies": { "@astral-sh/ruff-wasm-web": "0.6.9", "@codemirror/lang-json": "^6.0.1", diff --git a/package.json b/package.json index 9946b4d..2fdad99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ViperIDE", - "version": "0.5.5", + "version": "0.5.6", "description": "An innovative MicroPython / CircuitPython IDE for Web and Mobile", "main": "index.js", "scripts": { diff --git a/src/package_mgr.js b/src/package_mgr.js index 5bf6cea..c1d3db4 100644 --- a/src/package_mgr.js +++ b/src/package_mgr.js @@ -13,13 +13,14 @@ const MIP_INDEXES = [{ url: 'https://vsh.pp.ua/mip-featured', },{ name: 'emlearn-micropython', - url: 'https://vsh.pp.ua/emlearn', + url: 'https://emlearn.github.io/emlearn-micropython/builds', },{ name: 'micropython-lib', url: 'https://micropython.org/pi/v2', }] function rewriteUrl(url, { base=null, branch=null } = {}) { + //const input_url = url; if (url.startsWith('http://')) { url = 'https://' + url.slice(7) } @@ -36,10 +37,10 @@ function rewriteUrl(url, { base=null, branch=null } = {}) { url = 'github:' + url.split('/').slice(3).join('/') } } else if (url.startsWith('https://gitlab.com/')) { - const gitlabRegex = /https:\/\/gitlab\.com\/([^/]+)\/([^/]+)\/-\/raw\/([^/]+)\/(.*)$/ + const gitlabRegex = /https:\/\/gitlab\.com\/([^/]+)\/([^/]+)\/-\/(blob|tree)\/([^/]+)\/(.*?)(\?ref_type=.*)?$/ const match = url.match(gitlabRegex) if (match) { - const [, user, repo, urlBranch, filePath] = match + const [, user, repo, , urlBranch, filePath] = match branch = branch || urlBranch; url = `gitlab:${user}/${repo}/${filePath}` } else { @@ -63,6 +64,7 @@ function rewriteUrl(url, { base=null, branch=null } = {}) { base = base.replace(/\/[^/]*\.[^/]*$/, '') // Strip filename, if any url = base + '/' + url } + //console.log("Translated", input_url, "=>", url) return url }