Skip to content

Commit

Permalink
vsix: can run in secure mode + better queue
Browse files Browse the repository at this point in the history
  • Loading branch information
yne committed Dec 17, 2023
1 parent 7bc2422 commit 977e1a6
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 12 deletions.
7 changes: 4 additions & 3 deletions extension/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ class DzrWebView { // can't Audio() in VSCode, we need a webview
/**@returns {vscode.TreeItem} */
getTreeItem = (item) => ({
iconPath: vscode.ThemeIcon.File,
label: item.title,
description: item.artists.map(a => a.name).join(),
label: item.title + ' - ' + item.artists.map(a => a.name).join(),
description: hhmmss(item.duration) + " " + (item.version||''),
contextValue: 'dzr.track',
command: { title: 'Play', command: 'dzr.load', tooltip: 'Play', arguments: [this.state.queue.indexOf(item)] },
tooltip: hhmmss(item.duration)//JSON.stringify(item, null, 2),
//tooltip: JSON.stringify(item, null, 2),
})
getChildren = () => this.state.queue
async handleDrag(sources, treeDataTransfer, token) {
Expand Down Expand Up @@ -203,6 +203,7 @@ exports.activate = async function (/**@type {vscode.ExtensionContext}*/ context)
vscode.commands.registerCommand('dzr.show', () => dzr.show(htmlUri, iconUri)),
vscode.commands.registerCommand("dzr.play", () => dzr.post('play')),
vscode.commands.registerCommand("dzr.pause", () => dzr.post('pause')),
vscode.commands.registerCommand("dzr.href", (track) => vscode.env.openExternal(vscode.Uri.parse(`https://deezer.com/track/${track.id}`))),
vscode.commands.registerCommand("dzr.loopQueue", () => dzr.state.looping = "queue"),
vscode.commands.registerCommand("dzr.loopTrack", () => dzr.state.looping = "track"),
vscode.commands.registerCommand("dzr.loopOff", () => dzr.state.looping = "off"),
Expand Down
41 changes: 32 additions & 9 deletions extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
"activationEvents": [
"onStartupFinished"
],
"capabilities": {
"untrustedWorkspaces": {
"supported": true
}
},
"contributes": {
"viewsWelcome": [
{
Expand All @@ -41,6 +46,13 @@
"title": "Play",
"icon": "$(debug-run)"
},
{
"category": "dzr",
"command": "dzr.href",
"title": "Open Web",
"when": "false",
"icon": "$(link-external)"
},
{
"category": "dzr",
"command": "dzr.pause",
Expand Down Expand Up @@ -81,12 +93,14 @@
"category": "dzr",
"command": "dzr.remove",
"title": "Queue Remove Track",
"when": "false",
"icon": "$(close)"
},
{
"category": "dzr",
"command": "dzr.removeAt",
"title": "Queue Remove Track",
"when": "false",
"icon": "$(close)"
},
{
Expand Down Expand Up @@ -139,12 +153,17 @@
{
"group": "inline",
"command": "dzr.remove",
"when": "viewItem == dzr.track"
"when": "viewItem == dzr.track && !listMultiSelection"
},
{
"group": "navigation",
"command": "dzr.href",
"when": "viewItem == dzr.track && !listMultiSelection"
},
{
"group": "navigation",
"command": "dzr.remove",
"when": "viewItem == dzr.track"
"when": "viewItem == dzr.track && listMultiSelection"
}
]
},
Expand All @@ -164,7 +183,11 @@
},
"dzr.looping": {
"type": "string",
"enum": ["queue", "track", "off"],
"enum": [
"queue",
"track",
"off"
],
"default": "queue",
"description": "Queue looping"
},
Expand Down Expand Up @@ -299,11 +322,11 @@
},
"viewsContainers": {
"activitybar": [
{
"id": "dzr",
"title": "dzr",
"icon": "logo.svg"
}
{
"id": "dzr",
"title": "dzr",
"icon": "logo.svg"
}
]
},
"views": {
Expand All @@ -316,4 +339,4 @@
]
}
}
}
}

0 comments on commit 977e1a6

Please sign in to comment.