Merge branch 'bastienwirtz:main' into apikey

This commit is contained in:
Robin Schneider 2021-10-25 14:06:41 +02:00 committed by GitHub
commit f2c901a1ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 5 deletions

View File

@ -19,6 +19,9 @@ logo: "assets/logo.png"
# icon: "fas fa-skull-crossbones" # icon: "fas fa-skull-crossbones"
header: true # Set to false to hide the header header: true # Set to false to hide the header
# Optional: Different hotkey for search, defaults to "/"
# hotkey:
# search: "Shift"
footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it. footer: '<p>Created with <span class="has-text-danger">❤️</span> with <a href="https://bulma.io/">bulma</a>, <a href="https://vuejs.org/">vuejs</a> & <a href="https://fontawesome.com/">font awesome</a> // Fork me on <a href="https://github.com/bastienwirtz/homer"><i class="fab fa-github-alt"></i></a></p>' # set false if you want to hide it.
columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12) columns: "3" # "auto" or number (must be a factor of 12: 1, 2, 3, 4, 6, 12)

View File

@ -97,8 +97,9 @@ For Ping you need to set the type to Ping and provide a url.
- name: "Awesome app" - name: "Awesome app"
type: Ping type: Ping
logo: "assets/tools/sample.png" logo: "assets/tools/sample.png"
subtitle: "Bookmark example" tag: "app" subtitle: "Bookmark example"
url: "https://www.reddit.com/r/selfhosted/" tag: "app"
url: "https://www.reddit.com/r/selfhosted/"
``` ```
## Prometheus ## Prometheus

View File

@ -41,6 +41,7 @@
<SearchInput <SearchInput
class="navbar-item is-inline-block-mobile" class="navbar-item is-inline-block-mobile"
:hotkey=searchHotkey()
@input="filterServices" @input="filterServices"
@search-focus="showMenu = true" @search-focus="showMenu = true"
@search-open="navigateToFirstService" @search-open="navigateToFirstService"
@ -167,6 +168,11 @@ export default {
window.onhashchange = this.buildDashboard; window.onhashchange = this.buildDashboard;
}, },
methods: { methods: {
searchHotkey() {
if (this.config.hotkey && this.config.hotkey.search) {
return this.config.hotkey.search;
}
},
buildDashboard: async function () { buildDashboard: async function () {
const defaults = jsyaml.load(defaultConfig); const defaults = jsyaml.load(defaultConfig);
let config; let config;

View File

@ -15,10 +15,16 @@
<script> <script>
export default { export default {
name: "SearchInput", name: "SearchInput",
props: ["value"], props: {
value: String,
hotkey: {
type: String,
default: "/"
}
},
mounted() { mounted() {
this._keyListener = function (event) { this._keyListener = function (event) {
if (event.key === "/") { if (event.key === this.hotkey) {
event.preventDefault(); event.preventDefault();
this.focus(); this.focus();
} }
@ -28,7 +34,7 @@ export default {
}; };
document.addEventListener("keydown", this._keyListener.bind(this)); document.addEventListener("keydown", this._keyListener.bind(this));
// fill seach from get parameter. // fill search from get parameter.
const search = new URLSearchParams(window.location.search).get("search"); const search = new URLSearchParams(window.location.search).get("search");
if (search) { if (search) {
this.$refs.search.value = search; this.$refs.search.value = search;