Skip to content

Commit

Permalink
chore: rename phcode protcol to phtauri
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Nov 9, 2023
1 parent 9f994d8 commit 3a7dbcf
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/assets/new-project/assets/js/new-project-more.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("phcode://") || iconURL.startsWith("asset://"))){
|| iconURL.startsWith("phtauri://") || iconURL.startsWith("asset://"))){
return iconURL;
}
return 'images/tab-img2.png'; // HTML icon
Expand Down
2 changes: 1 addition & 1 deletion src/extensibility/Package.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ define(function (require, exports, module) {
return d.promise();
}
if (!(parsed.protocol === "http:" || parsed.protocol === "https:"
|| parsed.protocol === "phcode:" || parsed.protocol === "asset:")) {
|| parsed.protocol === "phtauri:" || parsed.protocol === "asset:")) {
d.reject(Errors.UNSUPPORTED_PROTOCOL);
return d.promise();
}
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/HTMLCodeHints/HTMLJumpToDef.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ define(function (require, exports, module) {

function _openFile(fileRelativePath, mainDocPath) {
if(fileRelativePath.startsWith("http://") || fileRelativePath.startsWith("https://")
|| fileRelativePath.startsWith("phcode://") || fileRelativePath.startsWith("asset://")){
|| fileRelativePath.startsWith("phtauri://") || fileRelativePath.startsWith("asset://")){
return FileViewController.openAndSelectDocument(fileRelativePath, FileViewController.PROJECT_MANAGER);
}
const targetPath = path.resolve(mainDocPath, fileRelativePath);
Expand Down
2 changes: 1 addition & 1 deletion src/extensions/default/QuickView/ImagePreviewProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:", "phcode:", "asset:", "ftp:", "file:"];
let validProtocols = ["data:", "http:", "https:", "phtauri:", "asset:", "ftp:", "file:"];

prefs = PreferencesManager.getExtensionPrefs("quickview");

Expand Down
6 changes: 3 additions & 3 deletions src/extensions/default/RemoteFileAdapter/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ define(function (require, exports, module) {

const HTTP_PROTOCOL = "http:",
HTTPS_PROTOCOL = "https:",
TAURI_PROTOCOL = "phcode:",
TAURI_PROTOCOL = "phtauri:",
TAURI_ASSET_PROTOCOL = "asset:";

ExtensionUtils.loadStyleSheet(module, "styles.css");
Expand All @@ -48,8 +48,8 @@ define(function (require, exports, module) {
return "https";
}

if (data.fullPath.startsWith("phcode://")) {
return "phcode";
if (data.fullPath.startsWith("phtauri://")) {
return "phtauri";
}

if (data.fullPath.startsWith("asset://")) {
Expand Down
2 changes: 1 addition & 1 deletion src/filesystem/FileSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -1221,7 +1221,7 @@ define(function (require, exports, module) {
// attach remote file handlers
var HTTP_PROTOCOL = "http:",
HTTPS_PROTOCOL = "https:",
TAURI_PROTOCOL = "phcode:",
TAURI_PROTOCOL = "phtauri:",
TAURI_ASSET_PROTOCOL = "asset:";

var protocolAdapter = {
Expand Down
6 changes: 3 additions & 3 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
javascript module section only!!-->
<script>
if(location.href.startsWith("tauri://") || location.href.startsWith('https://tauri.localhost')){
const errorMessage = `You should use custom protocol phcode:// instead of tauri protocol ${location.href} .`;
const errorMessage = `You should use custom protocol phtauri:// instead of tauri protocol ${location.href} .`;
alert(errorMessage);
console.error(errorMessage);
throw new Error(errorMessage);
Expand Down Expand Up @@ -268,8 +268,8 @@
'http://127.0.0.1:8000': true, // phcode dev server
'http://127.0.0.1:8001': true, // phcode dev live preview server
'http://127.0.0.1:5000': true, // playwright tests
'phcode://localhost': true, // tauri prod app
'https://phcode.localhost': true, // tauri
'phtauri://localhost': true, // tauri prod app
'https://phtauri.localhost': true, // tauri
'https://phcode.live': true, // phcode prod live preview server
'https://phcode.dev': true,
'https://dev.phcode.dev': true,
Expand Down
2 changes: 1 addition & 1 deletion src/phoenix/shell.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ initVFS();

// We can only have a maximum of 30 windows that have access to tauri apis
// This limit is set in file `tauri.conf.json` in phoenix-desktop repo at json paths
// this limit is there due to our use of phcode:// custom protocol.
// this limit is there due to our use of phtauri:// custom protocol.
// /tauri/security/dangerousRemoteDomainIpcAccess/0/windows and
// /tauri/security/dangerousRemoteDomainIpcAccess/1/windows
let MAX_ALLOWED_TAURI_WINDOWS = 30;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/ExtensionLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ define(function (require, exports, module) {
*/
function _mergeConfig(baseConfig) {
if(baseConfig.baseUrl.startsWith("http://") || baseConfig.baseUrl.startsWith("https://")
|| baseConfig.baseUrl.startsWith("phcode://") || baseConfig.baseUrl.startsWith("asset://")) {
|| baseConfig.baseUrl.startsWith("phtauri://") || baseConfig.baseUrl.startsWith("asset://")) {
return _mergeConfigFromURL(baseConfig);
}
throw new Error("Config can only be loaded from an http url, but got" + baseConfig.baseUrl);
Expand Down Expand Up @@ -394,7 +394,7 @@ define(function (require, exports, module) {
var result = new $.Deferred(),
extensionPath = config.baseUrl + "/" + entryPoint + ".js";
if(extensionPath.startsWith("http://") || extensionPath.startsWith("https://")
|| extensionPath.startsWith("phcode://") || extensionPath.startsWith("asset://")) {
|| extensionPath.startsWith("phtauri://") || extensionPath.startsWith("asset://")) {
return _testExtensionByURL(name, config, entryPoint);
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils/ExtensionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ define(function (require, exports, module) {
*/
function loadMetadata(metadataURL, extensionName) {
if(metadataURL.startsWith("http://") || metadataURL.startsWith("https://")
|| metadataURL.startsWith("phcode://") || metadataURL.startsWith("asset://")) {
|| metadataURL.startsWith("phtauri://") || metadataURL.startsWith("asset://")) {
return _loadExtensionMetadata(metadataURL, extensionName);
}
throw new Error(`Cannot load extension metadata for ${extensionName} at path ${metadataURL}`);
Expand Down
2 changes: 1 addition & 1 deletion src/view/ThemeManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ define(function (require, exports, module) {
*/
function loadFile(fileName, options) {
if(fileName.startsWith("http://") || fileName.startsWith("https://")
|| fileName.startsWith("phcode://") || fileName.startsWith("asset://")) {
|| fileName.startsWith("phtauri://") || fileName.startsWith("asset://")) {
if(Phoenix.VFS.getPathForVirtualServingURL(fileName)){
fileName = Phoenix.VFS.getPathForVirtualServingURL(fileName);
} else {
Expand Down
6 changes: 3 additions & 3 deletions test/SpecRunner.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
connect-src * localhost:* asset: https://asset.localhost ;">
<script type="text/javascript">
if(location.href.startsWith("tauri://") || location.href.startsWith('https://tauri.localhost')){
const errorMessage = `You should use custom protocol phcode:// instead of tauri protocol ${location.href} .`;
const errorMessage = `You should use custom protocol phtauri:// instead of tauri protocol ${location.href} .`;
alert(errorMessage);
console.error(errorMessage);
throw new Error(errorMessage);
Expand Down Expand Up @@ -245,8 +245,8 @@
'http://127.0.0.1:8000': true, // phcode dev server
'http://127.0.0.1:8001': true, // phcode dev live preview server
'http://127.0.0.1:5000': true, // playwright tests
'phcode://localhost': true, // tauri prod app
'https://phcode.localhost': true, // tauri
'phtauri://localhost': true, // tauri prod app
'https://phtauri.localhost': true, // tauri
'https://phcode.live': true, // phcode prod live preview server
'https://phcode.dev': true,
'https://dev.phcode.dev': true,
Expand Down

0 comments on commit 3a7dbcf

Please sign in to comment.