generated from elgatosf/streamdeck-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7697056
Showing
42 changed files
with
3,408 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
.idea/** | ||
/src/DistributionTool | ||
dev.jduabe.obsideck | ||
.vscode/** | ||
package.json | ||
.history | ||
__exclude | ||
.editorconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "src/dev.jduabe.obsideck.sdPlugin/libs"] | ||
path = src/dev.jduabe.obsideck.sdPlugin/libs | ||
url = https://github.com/elgatosf/streamdeck-javascript-sdk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Jordan Duabe @j4ckofalltrades <me@jduabe.dev> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<div align="center"> | ||
<br/> | ||
<a href="https://github.com/j4ckofalltrades/obsideck"> | ||
<img height="128" src="src/dev.jduabe.obsideck.sdPlugin/assets/plugin.png" alt="Logo"> | ||
</a> | ||
</div> | ||
|
||
<br/> | ||
|
||
# Obsideck | ||
|
||
A Stream Deck plugin that runs commands in Obsidian (via the Local Rest API plugin). | ||
|
||
## Getting Started | ||
|
||
1. Install the [Local REST API plugin](https://github.com/coddingtonbear/obsidian-local-rest-api) for Obsidian. | ||
2. Download and install this Stream Deck plugin from the [Release](./Release) directory. | ||
|
||
## Configuration | ||
|
||
![](src/dev.jduabe.obsideck.sdPlugin/previews/1-preview.png) | ||
|
||
The `Run Command` action has the following __required__ properties: | ||
|
||
- URL | ||
- API Key | ||
- Command ID | ||
|
||
The `URL` and `API Key` properties can be found in the plugins' settings in Obsidian. | ||
|
||
The list of available commands can be obtained by calling the `/commands` endpoint or through the plugin's [docs](https://coddingtonbear.github.io/obsidian-local-rest-api). | ||
|
||
Note: The API plugin uses HTTPS by default. | ||
|
||
```bash | ||
curl -X 'GET' \ | ||
'http://127.0.0.1:27123/commands/' \ | ||
-H 'Accept: application/json' \ | ||
-H 'Authorization: Bearer api_key' | ||
|
||
# Sample response | ||
{ | ||
"commands": [ | ||
{ | ||
"id": "app:open-help", | ||
"name": "Open Help" | ||
} | ||
] | ||
} | ||
``` |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
|
||
<head> | ||
<title>dev.jduabe.obsideck</title> | ||
<meta charset="utf-8" /> | ||
<style> | ||
canvas { | ||
background-color: transparent; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<!-- Stream Deck Libs --> | ||
<script src="libs/js/constants.js"></script> | ||
<script src="libs/js/prototypes.js"></script> | ||
<script src="libs/js/timers.js"></script> | ||
<script src="libs/js/utils.js"></script> | ||
<script src="libs/js/events.js"></script> | ||
<script src="libs/js/api.js"></script> | ||
<script src="libs/js/stream-deck.js"></script> | ||
<script src="libs/js/action.js"></script> | ||
|
||
<!-- Plugin Source --> | ||
<script src="app.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// <reference path="libs/js/action.js" /> | ||
/// <reference path="libs/js/stream-deck.js" /> | ||
|
||
var settings = {}; | ||
var runCommandAction = new Action("dev.jduabe.obsideck.runcommand"); | ||
|
||
runCommandAction.onWillAppear((event) => { | ||
$SD.getSettings(event.context); | ||
}); | ||
|
||
runCommandAction.onDidReceiveSettings(({ payload }) => { | ||
settings = payload.settings; | ||
}); | ||
|
||
runCommandAction.onKeyUp(({ context }) => { | ||
const apiKey = settings.apiKey; | ||
const commandId = settings.commandId; | ||
const url = settings.url; | ||
|
||
fetch(`${url}/commands/${encodeURIComponent(commandId)}/`, { | ||
method: "POST", | ||
headers: { | ||
"Accept": "*/*", | ||
"Authorization": "Bearer " + apiKey, | ||
} | ||
}) | ||
.then(response => { | ||
if (response.ok) { | ||
$SD.showOk(context); | ||
} else { | ||
$SD.showAlert(context); | ||
} | ||
}) | ||
.catch(err => $SD.showAlert(context)); | ||
}); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" | ||
content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover" /> | ||
<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
<meta name="apple-mobile-web-app-status-bar-style" content="black" /> | ||
<title>dev.jduabe.obsideck Property Inspector</title> | ||
<link rel="stylesheet" href="libs/css/sdpi.css" /> | ||
</head> | ||
|
||
<body> | ||
<form id="property-inspector"> | ||
<div class="sdpi-wrapper" id="mainWrapper"> | ||
<div class="sdpi-item"> | ||
<div class="sdpi-item-label">URL</div> | ||
<input class="sdpi-item-value" id="url" name="url" required value="" type="text" | ||
placeholder="fully qualified url e.g. http://127.0.0.1:27123" /> | ||
</div> | ||
|
||
<div class="sdpi-item"> | ||
<div class="sdpi-item-label">API Key</div> | ||
<input class="sdpi-item-value" id="apiKey" name="apiKey" required value="" type="password" /> | ||
</div> | ||
|
||
<div class="sdpi-item"> | ||
<div class="sdpi-item-label">Command ID</div> | ||
<input class="sdpi-item-value" id="commandId" name="commandId" required value="" type="text" /> | ||
</div> | ||
</div> | ||
</form> | ||
|
||
<!-- Stream Deck Libs --> | ||
<script src="libs/js/constants.js"></script> | ||
<script src="libs/js/prototypes.js"></script> | ||
<script src="libs/js/timers.js"></script> | ||
<script src="libs/js/utils.js"></script> | ||
<script src="libs/js/events.js"></script> | ||
<script src="libs/js/api.js"></script> | ||
<script src="libs/js/property-inspector.js"></script> | ||
<script src="libs/js/dynamic-styles.js"></script> | ||
|
||
<!-- Property Inspector Source --> | ||
<script src="inspector.js"></script> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/// <reference path="libs/js/property-inspector.js" /> | ||
/// <reference path="libs/js/utils.js" /> | ||
|
||
$PI.onConnected((jsn) => { | ||
const form = document.querySelector('#property-inspector'); | ||
const { actionInfo: { payload: { settings } } } = jsn; | ||
|
||
Utils.setFormValue(settings, form); | ||
|
||
form.addEventListener( | ||
'input', | ||
Utils.debounce(150, () => { | ||
const value = Utils.getFormValue(form); | ||
$PI.setSettings(value); | ||
}) | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.history |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"useTabs": true, | ||
"singleQuote": true, | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# streamdeck-javascript-sdk | ||
|
||
A library for plugins used for connecting to Stream Deck. This does not require a build step and declares variables in | ||
the global scope directly in the class files. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
src/dev.jduabe.obsideck.sdPlugin/libs/assets/caret_closed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions
25
src/dev.jduabe.obsideck.sdPlugin/libs/assets/elg_calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions
7
src/dev.jduabe.obsideck.sdPlugin/libs/assets/elg_calendar_inv.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.