Skip to content

Commit

Permalink
Merge pull request #363 from hypermodules/dependabot/npm_and_yarn/ele…
Browse files Browse the repository at this point in the history
…ctron-28.0.0

Bump electron from 27.1.3 to 28.0.0
  • Loading branch information
bcomnes authored Dec 17, 2023
2 parents 4e28295 + 8fcd067 commit 3f47c83
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
"electron-window-state": "^5.0.2",
"entypo": "^2.1.0",
"existy": "^1.0.1",
"file-url": "^3.0.0",
"flush-write-stream": "^2.0.0",
"folder-walker": "^3.2.0",
"format-duration": "^3.0.2",
Expand All @@ -110,7 +109,7 @@
"common-shakeify": "^1.1.2",
"concat-stream": "^2.0.0",
"dependency-check": "^4.1.0",
"electron": "^27.0.1",
"electron": "^28.0.0",
"electron-builder": "^24.4.0",
"electron-renderify": "0.0.2",
"envify": "^4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion renderer/audio/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const path = require('path')
const mainState = remote.require('./index.js')
const needle = 'file://' + path.resolve(__dirname, 'needle.mp3')
let startupNode = document.querySelector('#needle')
const fileUrlFromPath = require('file-url')
const fileUrlFromPath = require('../shared/file-url')

needleSound(startupNode, needle, mainState.volume, mainState.muted)

Expand Down
2 changes: 1 addition & 1 deletion renderer/player/elements/player/artwork.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const html = require('choo/html')
const Component = require('nanocomponent')
const fileUrlFromPath = require('file-url')
const fileUrlFromPath = require('../../../shared/file-url')
const path = require('path')
const defaultBG = path.resolve(window.__dirname, 'default-artwork.png')
const compare = require('nanocomponent/compare')
Expand Down
30 changes: 30 additions & 0 deletions renderer/shared/file-url.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const path = require('path')

// Vendored from https://github.com/sindresorhus/file-url/blob/982123e9af861ce26167de7ef40be3ff9cad2be7/index.js#L2
// because inconvient ESM upgrade

function fileUrl (filePath, options = {}) {
if (typeof filePath !== 'string') {
throw new TypeError(`Expected a string, got ${typeof filePath}`)
}

const { resolve = true } = options

let pathName = filePath
if (resolve) {
pathName = path.resolve(filePath)
}

pathName = pathName.replace(/\\/g, '/')

// Windows drive letter must be prefixed with a slash.
if (pathName[0] !== '/') {
pathName = `/${pathName}`
}

// Escape required characters for path components.
// See: https://tools.ietf.org/html/rfc3986#section-3.3
return encodeURI(`file://${pathName}`).replace(/[?#]/g, encodeURIComponent)
}

module.exports = fileUrl

0 comments on commit 3f47c83

Please sign in to comment.