From 735c3c263d9207cd981190952c92eb94b9073d37 Mon Sep 17 00:00:00 2001 From: abose Date: Thu, 26 Oct 2023 14:43:04 +0530 Subject: [PATCH] chore: move to phcode protocol in tauri instead of tauri protocol --- src/assets/new-project/assets/js/new-project-more.js | 2 +- src/extensibility/Package.js | 2 +- src/extensions/default/HTMLCodeHints/HTMLJumpToDef.js | 2 +- .../default/QuickView/ImagePreviewProvider.js | 2 +- src/extensions/default/RemoteFileAdapter/main.js | 6 +++--- src/filesystem/FileSystem.js | 2 +- src/index.html | 9 ++++++++- src/utils/ExtensionLoader.js | 4 ++-- src/utils/ExtensionUtils.js | 2 +- src/view/ThemeManager.js | 2 +- test/SpecRunner.html | 10 ++++++++-- 11 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/assets/new-project/assets/js/new-project-more.js b/src/assets/new-project/assets/js/new-project-more.js index 969f0fffc9..039d0a46d0 100644 --- a/src/assets/new-project/assets/js/new-project-more.js +++ b/src/assets/new-project/assets/js/new-project-more.js @@ -31,7 +31,7 @@ function _getIconURL(iconURL) { } else if(iconURL === 'appLogo'){ return 'images/logo.png'; } else if(iconURL && (iconURL.startsWith("https://") || iconURL.startsWith("http://") - || iconURL.startsWith("tauri://") || iconURL.startsWith("asset://"))){ + || iconURL.startsWith("phcode://") || iconURL.startsWith("asset://"))){ return iconURL; } return 'images/tab-img2.png'; // HTML icon diff --git a/src/extensibility/Package.js b/src/extensibility/Package.js index 491c3b06ce..912d066224 100644 --- a/src/extensibility/Package.js +++ b/src/extensibility/Package.js @@ -242,7 +242,7 @@ define(function (require, exports, module) { return d.promise(); } if (!(parsed.protocol === "http:" || parsed.protocol === "https:" - || parsed.protocol === "tauri:" || parsed.protocol === "asset:")) { + || parsed.protocol === "phcode:" || parsed.protocol === "asset:")) { d.reject(Errors.UNSUPPORTED_PROTOCOL); return d.promise(); } diff --git a/src/extensions/default/HTMLCodeHints/HTMLJumpToDef.js b/src/extensions/default/HTMLCodeHints/HTMLJumpToDef.js index 71de6b2b07..ff184ec086 100644 --- a/src/extensions/default/HTMLCodeHints/HTMLJumpToDef.js +++ b/src/extensions/default/HTMLCodeHints/HTMLJumpToDef.js @@ -59,7 +59,7 @@ define(function (require, exports, module) { function _openFile(fileRelativePath, mainDocPath) { if(fileRelativePath.startsWith("http://") || fileRelativePath.startsWith("https://") - || fileRelativePath.startsWith("tauri://") || fileRelativePath.startsWith("asset://")){ + || fileRelativePath.startsWith("phcode://") || fileRelativePath.startsWith("asset://")){ return FileViewController.openAndSelectDocument(fileRelativePath, FileViewController.PROJECT_MANAGER); } const targetPath = path.resolve(mainDocPath, fileRelativePath); diff --git a/src/extensions/default/QuickView/ImagePreviewProvider.js b/src/extensions/default/QuickView/ImagePreviewProvider.js index f4eafaab1a..9856100bd4 100644 --- a/src/extensions/default/QuickView/ImagePreviewProvider.js +++ b/src/extensions/default/QuickView/ImagePreviewProvider.js @@ -41,7 +41,7 @@ define(function (require, exports, module) { extensionlessImagePreview; // Whether to try and preview extensionless URLs // List of protocols which we will support for image preview urls - let validProtocols = ["data:", "http:", "https:", "tauri:", "asset:", "ftp:", "file:"]; + let validProtocols = ["data:", "http:", "https:", "phcode:", "asset:", "ftp:", "file:"]; prefs = PreferencesManager.getExtensionPrefs("quickview"); diff --git a/src/extensions/default/RemoteFileAdapter/main.js b/src/extensions/default/RemoteFileAdapter/main.js index d124daa633..dd5de98406 100644 --- a/src/extensions/default/RemoteFileAdapter/main.js +++ b/src/extensions/default/RemoteFileAdapter/main.js @@ -34,7 +34,7 @@ define(function (require, exports, module) { const HTTP_PROTOCOL = "http:", HTTPS_PROTOCOL = "https:", - TAURI_PROTOCOL = "tauri:", + TAURI_PROTOCOL = "phcode:", TAURI_ASSET_PROTOCOL = "asset:"; ExtensionUtils.loadStyleSheet(module, "styles.css"); @@ -48,8 +48,8 @@ define(function (require, exports, module) { return "https"; } - if (data.fullPath.startsWith("tauri://")) { - return "tauri"; + if (data.fullPath.startsWith("phcode://")) { + return "phcode"; } if (data.fullPath.startsWith("asset://")) { diff --git a/src/filesystem/FileSystem.js b/src/filesystem/FileSystem.js index e928b4f0c6..a686cb0761 100644 --- a/src/filesystem/FileSystem.js +++ b/src/filesystem/FileSystem.js @@ -1221,7 +1221,7 @@ define(function (require, exports, module) { // attach remote file handlers var HTTP_PROTOCOL = "http:", HTTPS_PROTOCOL = "https:", - TAURI_PROTOCOL = "tauri:", + TAURI_PROTOCOL = "phcode:", TAURI_ASSET_PROTOCOL = "asset:"; var protocolAdapter = { diff --git a/src/index.html b/src/index.html index c615a3b988..99c506c631 100644 --- a/src/index.html +++ b/src/index.html @@ -44,6 +44,12 @@