Skip to content

Commit

Permalink
refactor: consume explorer from new desktop artifacts (#147)
Browse files Browse the repository at this point in the history
* refactor: consume from @dcl/explorer instead of @dcl/explorer-desktop

* increase version

* fix
  • Loading branch information
kuruk-mm committed Feb 9, 2023
1 parent f46353d commit d0077fb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Decentraland Explorer Desktop Launcher

A launcher to auto update the `explorer-desktop` (https://github.com/decentraland/explorer-desktop)
A launcher to auto update the `unity-renderer` (https://github.com/decentraland/unity-renderer)

## Available Scripts

Expand Down
15 changes: 6 additions & 9 deletions electron/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const getRemoteVersion = async (launcherPaths: LauncherPaths) => {
'x-debug-rollouts': true
}
})
return response.data.map['@dcl/explorer-desktop'].version
return response.data.map['@dcl/explorer'].version
}
} else {
// Dev
Expand All @@ -52,12 +52,12 @@ const getRemoteVersion = async (launcherPaths: LauncherPaths) => {
}

const isValidVersion = (version: string) => {
const versionRegex = /commit-[0-9a-f]{7}$/g
if (isUsingRollout()) {
const regex = /commit-[0-9a-f]{7}$/g
return version.match(regex)
return version.match(versionRegex)
} else {
const regex = /[0-9a-f]{40}/g
return version.match(regex)
return version.match(regex) || version.match(versionRegex)
}
}

Expand Down Expand Up @@ -88,10 +88,7 @@ const registerVersionEvent = (launcherPaths: LauncherPaths) => {
? JSON.stringify(`dev-desktop-${main.config.desktopBranch}.commit-${remoteVersion.substring(0, 7)}`)
: JSON.stringify(`desktop-${remoteVersion}`)

await event.sender.executeJavaScript(`globalThis.ROLLOUTS['@dcl/unity-renderer']['version'] = ${desktopVersion};`)
await event.sender.executeJavaScript(
`globalThis.ROLLOUTS['@dcl/explorer-desktop'] = { 'version': ${desktopVersion} };`
)
await event.sender.executeJavaScript(`globalThis.ROLLOUTS['@dcl/explorer'] = { 'version': ${desktopVersion} };`)
}
})
}
Expand Down Expand Up @@ -210,7 +207,7 @@ const registerExecuteProcessEvent = (rendererPath: string, executablePath: strin
const getArtifactUrl = (launcherPaths: LauncherPaths) => {
if (isUsingRollout()) {
// Rollout
const baseUrl = 'https://cdn.decentraland.org/@dcl/explorer-desktop/'
const baseUrl = 'https://renderer-artifacts.decentraland.org/release-desktop/'
return `${baseUrl}${encodeURIComponent(remoteVersion)}/${encodeURIComponent(launcherPaths.artifactUrl)}`
} else {
// Dev
Expand Down
2 changes: 1 addition & 1 deletion electron/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const loadDecentralandWeb = async (win: BrowserWindow) => {
if (main.isDefaultWeb) await showLoading(win)

const stage = main.config.developerMode ? 'zone' : 'org'
const url = new URL(main.config.customUrl || `http://play.decentraland.${stage}/?renderer-version=loading`)
const url = new URL(main.config.customUrl || `http://play.decentraland.${stage}/?`)

const customParamObj = new URLSearchParams(main.config.customParams)
for (const [key, value] of Array.from(customParamObj.entries())) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "explorer-desktop-launcher",
"version": "0.1.45",
"version": "0.1.46",
"author": "decentraland",
"description": "Decentraland Desktop Launcher",
"homepage": ".",
Expand Down Expand Up @@ -142,4 +142,4 @@
"last 1 safari version"
]
}
}
}
18 changes: 4 additions & 14 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,8 @@
</div>
<div id="dev" class="container" hidden="true">
<div class="form">
<label>explorer-desktop branch:</label></br>
<input type="text" value="main" id="explorer-desktop-branch" /></br></br>

<label>kernel branch:</label>
<input onchange="checkChange(`kernel-branch`)" type="checkbox" id="check-kernel-branch" /></br>
<input oninput="updateUrl()" type="text" value="main" id="kernel-branch" disabled='' /></br></br>
<label>explorer branch:</label></br>
<input type="text" value="main" id="explorer-branch" /></br></br>

<label>explorer-website branch:</label>
<input onchange="checkChange(`explorer-website-branch`)" type="checkbox"
Expand All @@ -124,13 +120,11 @@
let baseUrl = `http://play.decentraland.org/?`

const updateUrl = () => {
const hasKernelBranch = document.getElementById("check-kernel-branch").checked
const hasExplorerWebsiteBranch = document.getElementById("check-explorer-website-branch").checked
const hasCustomParam = document.getElementById("check-custom-param").checked
const hasPreviewCustomParam = document.getElementById("preview-check-custom-param").checked
const hasCustomUrl = document.getElementById("check-custom-url").checked

const kernelBranch = document.getElementById("kernel-branch").value
const explorerWebsiteBranch = document.getElementById("explorer-website-branch").value
const customParam = document.getElementById("custom-param").value
const previewCustomParam = document.getElementById("preview-custom-param").value
Expand All @@ -145,10 +139,6 @@
: baseUrl
)

if (hasKernelBranch) {
newUrl.searchParams.append('kernel-branch', '')
}

if (hasCustomParam) {
const customParamObj = new URLSearchParams(customParam)
for (const [paramKey, paramValue] of customParamObj) {
Expand Down Expand Up @@ -177,7 +167,7 @@
}

const submitForm = () => {
const explorerDesktopBranch = document.getElementById("explorer-desktop-branch").value
const explorerDesktopBranch = document.getElementById("explorer-branch").value
const url = updateUrl()

console.log(url, explorerDesktopBranch)
Expand Down Expand Up @@ -212,7 +202,7 @@
document.getElementById("custom-url").value = previewMode
}

const explorerDesktopBranchElement = document.getElementById("explorer-desktop-branch")
const explorerDesktopBranchElement = document.getElementById("explorer-branch")
const customParamElement = document.getElementById("custom-param")
const customParamCheckElement = document.getElementById("check-custom-param")

Expand Down

0 comments on commit d0077fb

Please sign in to comment.