mirror of
https://github.com/nikdoof/ohayodash.git
synced 2025-12-17 03:49:29 +00:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
6e2d8bef16
|
|||
| 23fd1d045d | |||
|
|
7ea651c099 | ||
| d1bf7c5b55 | |||
| b960f77934 | |||
| 32b93a9e2f | |||
| 2f769da1c6 | |||
| f46e6b59df | |||
| a80d7a9dd3 | |||
| 654440a476 | |||
| c46d7ae252 | |||
| 8f7d47a579 | |||
| 0957513c41 | |||
| 7fa687defb | |||
|
147e03bb33
|
|||
|
|
18340a4f69 | ||
|
|
f5ac7cebc3 | ||
|
|
3681cda2fd | ||
|
|
c48dbdbaa7 | ||
|
|
75e067d585 | ||
|
|
70b2a720b7 | ||
|
|
57b17266c4 | ||
|
|
79c7311107 | ||
|
|
8b2c2dcc38 | ||
|
|
bb50e54ab2 | ||
|
|
a186e4b3c1 | ||
| a525a777ae | |||
|
7cf949ba26
|
|||
|
f3f99d1162
|
|||
|
44741b76bc
|
|||
|
559b5a8f80
|
|||
|
8f535ddf25
|
|||
|
7068d84718
|
|||
|
eced7966df
|
|||
|
d78a7531cf
|
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
38
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. iOS]
|
||||||
|
- Browser [e.g. chrome, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Smartphone (please complete the following information):**
|
||||||
|
- Device: [e.g. iPhone6]
|
||||||
|
- OS: [e.g. iOS8.1]
|
||||||
|
- Browser [e.g. stock browser, safari]
|
||||||
|
- Version [e.g. 22]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
||||||
8
.github/workflows/build-container.yaml
vendored
8
.github/workflows/build-container.yaml
vendored
@@ -12,11 +12,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v2
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Login to GHCR
|
- name: Login to GHCR
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v2
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
push: true
|
push: true
|
||||||
tags: |
|
tags: |
|
||||||
|
|||||||
4
.github/workflows/lint.yaml
vendored
4
.github/workflows/lint.yaml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out Git repository
|
- name: Check out Git repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: wemake-python-styleguide
|
- name: wemake-python-styleguide
|
||||||
uses: wemake-services/wemake-python-styleguide@0.16.0
|
uses: wemake-services/wemake-python-styleguide@0.17.0
|
||||||
|
|||||||
6
.github/workflows/release-chart.yaml
vendored
6
.github/workflows/release-chart.yaml
vendored
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
@@ -21,12 +21,12 @@ jobs:
|
|||||||
git config user.name "$GITHUB_ACTOR"
|
git config user.name "$GITHUB_ACTOR"
|
||||||
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
||||||
- name: Install Helm
|
- name: Install Helm
|
||||||
uses: azure/setup-helm@v1
|
uses: azure/setup-helm@v3
|
||||||
with:
|
with:
|
||||||
version: v3.6.3
|
version: v3.6.3
|
||||||
|
|
||||||
- name: Run chart-releaser
|
- name: Run chart-releaser
|
||||||
uses: helm/chart-releaser-action@v1.2.1
|
uses: helm/chart-releaser-action@v1.5.0
|
||||||
env:
|
env:
|
||||||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
CR_RELEASE_NAME_TEMPLATE: "ohayodash-helm-chart-{{ .Version }}"
|
CR_RELEASE_NAME_TEMPLATE: "ohayodash-helm-chart-{{ .Version }}"
|
||||||
|
|||||||
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -10,9 +10,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v4
|
||||||
- run: pip install -r requirements-dev.txt
|
- run: pip install -r requirements-dev.txt
|
||||||
|
|
||||||
- name: Build Assets
|
- name: Build Assets
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM python:3.9-alpine
|
FROM python:3.11-alpine
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./requirements.txt /app/requirements.txt
|
COPY ./requirements.txt /app/requirements.txt
|
||||||
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
|
||||||
|
|||||||
93
README.md
93
README.md
@@ -3,3 +3,96 @@
|
|||||||
Ohayo Dash is a Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
Ohayo Dash is a Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
||||||
|
|
||||||
This is inspired by [Hajimari](https://github.com/toboshii/hajimari) and [SUI](https://github.com/jeroenpardon/sui) projects.
|
This is inspired by [Hajimari](https://github.com/toboshii/hajimari) and [SUI](https://github.com/jeroenpardon/sui) projects.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
All configuration is handled with `ConfigMap` and `Ingress` objects within Kubernetes.
|
||||||
|
|
||||||
|
### Ingresses
|
||||||
|
|
||||||
|
All namespaces as processed by default, only Ingress objects with `ohayodash.github.io/enabled` annotation are then displayed.
|
||||||
|
|
||||||
|
Annotations can be used to customize the display of the Ingress objects:
|
||||||
|
|
||||||
|
* `ohayodash.github.io/name` - Display name of the app, defaults to the Ingress name.
|
||||||
|
* `ohayodash.github.io/url` - Target URL of the service, defaults to `https://<ingress host>`
|
||||||
|
* `ohayodash.github.io/show_url` - Shows the URL under the link, defaults to `false`
|
||||||
|
|
||||||
|
### Bookmarks
|
||||||
|
|
||||||
|
Bookmark are stored in `ConfigMap` resources, which are identified by the `ohayodash.github.io/bookmarks` annotation.
|
||||||
|
|
||||||
|
Values are pulled from the `bookmarks` key in the config map, which consists of a list of objects with the following keys:
|
||||||
|
|
||||||
|
* `name` - the display name of the link
|
||||||
|
* `url` - the target URL.
|
||||||
|
* `group` - the name the link is to be grouped under.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: ohayodash-bookmarks
|
||||||
|
namespace: web
|
||||||
|
annotations:
|
||||||
|
ohayodash.github.io/bookmarks: 'true'
|
||||||
|
data:
|
||||||
|
bookmarks: |
|
||||||
|
- name: Renovate Dashboard
|
||||||
|
url: "https://app.renovatebot.com/dashboard#github/nikdoof/flux-gitops"
|
||||||
|
group: Github
|
||||||
|
```
|
||||||
|
|
||||||
|
### Providers
|
||||||
|
|
||||||
|
Providers are stored in `ConfigMap` resources, which are identified by the `ohayodash.github.io/providers` annotation.
|
||||||
|
|
||||||
|
Values are pulled from the `providers` key in the config map, which consists of a list of objects with the following keys:
|
||||||
|
|
||||||
|
* `name` - the display name of the link
|
||||||
|
* `url` - the target URL of the service.
|
||||||
|
* `search` - suffix to add to search on the service, this will combine the URL, Search value and the text to search for into a URL.
|
||||||
|
* `prefix` - prefix to use on the URL bar on Ohayodash.
|
||||||
|
|
||||||
|
*Note*: If no Providers ConfigMaps are found then a [default](ohayodash/data/providers.yaml) list is used.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: ohayodash-providers
|
||||||
|
namespace: web
|
||||||
|
annotations:
|
||||||
|
ohayodash.github.io/providers: 'true'
|
||||||
|
data:
|
||||||
|
providers: |
|
||||||
|
- name: Allmusic
|
||||||
|
url: https://www.allmusic.com/
|
||||||
|
search: search/all/
|
||||||
|
prefix: /a
|
||||||
|
```
|
||||||
|
|
||||||
|
### Combining ConfigMaps
|
||||||
|
|
||||||
|
ConfigMaps can be combined to allow for easier management:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: ohayodash-config
|
||||||
|
namespace: web
|
||||||
|
annotations:
|
||||||
|
ohayodash.github.io/bookmarks: 'true'
|
||||||
|
ohayodash.github.io/providers: 'true'
|
||||||
|
data:
|
||||||
|
bookmarks: |
|
||||||
|
- name: Renovate Dashboard
|
||||||
|
url: "https://app.renovatebot.com/dashboard#github/nikdoof/flux-gitops"
|
||||||
|
group: Github
|
||||||
|
providers: |
|
||||||
|
- name: Allmusic
|
||||||
|
url: https://www.allmusic.com/
|
||||||
|
search: search/all/
|
||||||
|
prefix: /a
|
||||||
|
```
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
apiVersion: v2
|
apiVersion: v2
|
||||||
appVersion: 0.2.0
|
appVersion: 0.3.0
|
||||||
description: Ohayo Dash is a Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
description: Ohayo Dash is a Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
||||||
name: ohayodash
|
name: ohayodash
|
||||||
version: 0.2.0
|
version: 0.3.0
|
||||||
kubeVersion: ">=1.16.0-0"
|
kubeVersion: ">=1.19.0-0"
|
||||||
keywords:
|
keywords:
|
||||||
- ohayodash
|
- ohayodash
|
||||||
- startpage
|
- startpage
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ image:
|
|||||||
# -- image pull policy
|
# -- image pull policy
|
||||||
pullPolicy: IfNotPresent
|
pullPolicy: IfNotPresent
|
||||||
# -- image tag
|
# -- image tag
|
||||||
tag: 0.2.0
|
tag: 0.3.0
|
||||||
|
|
||||||
# -- environment variables.
|
# -- environment variables.
|
||||||
# @default -- See below
|
# @default -- See below
|
||||||
@@ -38,3 +38,24 @@ ingress:
|
|||||||
# @default -- See values.yaml
|
# @default -- See values.yaml
|
||||||
main:
|
main:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|
||||||
|
# configmap:
|
||||||
|
# bookmarks:
|
||||||
|
# enabled: false
|
||||||
|
# annotations:
|
||||||
|
# ohayodash.github.io/bookmarks: "true"
|
||||||
|
# data:
|
||||||
|
# bookmarks:
|
||||||
|
# - name: TV Calendar
|
||||||
|
# url: https://www.pogdesign.co.uk/cat/
|
||||||
|
# group: Tools
|
||||||
|
# providers:
|
||||||
|
# enabled: false
|
||||||
|
# annotations:
|
||||||
|
# ohayodash.github.io/providers: "true"
|
||||||
|
# data:
|
||||||
|
# providers:
|
||||||
|
# - name: Trakt
|
||||||
|
# url: https://trakt.tv/
|
||||||
|
# search: search?query=
|
||||||
|
# prefix: /t
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
import kubernetes
|
import kubernetes
|
||||||
|
import pkg_resources
|
||||||
import yaml
|
import yaml
|
||||||
from flask import Blueprint, jsonify, render_template
|
from flask import Blueprint, jsonify, render_template
|
||||||
|
|
||||||
@@ -103,6 +104,31 @@ def get_bookmarks(tag: str = None) -> list:
|
|||||||
return bookmarks
|
return bookmarks
|
||||||
|
|
||||||
|
|
||||||
|
def get_providers(tag: str = None) -> list:
|
||||||
|
"""Get all 'provider' ConfigMaps from the cluster and produce a provider list."""
|
||||||
|
v1 = kubernetes.client.CoreV1Api()
|
||||||
|
ret = v1.list_config_map_for_all_namespaces(watch=False)
|
||||||
|
|
||||||
|
providers = []
|
||||||
|
for cm in ret.items:
|
||||||
|
# Skip if the CM has no annotations
|
||||||
|
if cm.metadata.annotations is None:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip if its not tagged as bookmark CM
|
||||||
|
if '{0}/providers'.format(ANNOTATION_BASE) not in cm.metadata.annotations:
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Skip if we're limited to a tag, and the CM has tags but not that one.
|
||||||
|
if not check_tags(tag, cm):
|
||||||
|
continue
|
||||||
|
|
||||||
|
provider_data = yaml.safe_load(cm.data['providers'])
|
||||||
|
providers.extend(provider_data)
|
||||||
|
|
||||||
|
return providers
|
||||||
|
|
||||||
|
|
||||||
@base.route('/')
|
@base.route('/')
|
||||||
@base.route('/<tag>/')
|
@base.route('/<tag>/')
|
||||||
def index(tag=None):
|
def index(tag=None):
|
||||||
@@ -112,21 +138,12 @@ def index(tag=None):
|
|||||||
@base.route('/providers.json')
|
@base.route('/providers.json')
|
||||||
@base.route('/<tag>/providers.json')
|
@base.route('/<tag>/providers.json')
|
||||||
def providers(tag=None):
|
def providers(tag=None):
|
||||||
return jsonify({
|
k8s_providers = get_providers(tag)
|
||||||
'providers': [
|
if not k8s_providers:
|
||||||
{'name': 'Allmusic', 'url': 'https://www.allmusic.com/search/all/', 'prefix': '/a'},
|
data_file = pkg_resources.resource_filename(__name__, 'data/providers.yaml')
|
||||||
{'name': 'Discogs', 'url': 'https://www.discogs.com/search/?q=', 'prefix': '/di'},
|
with open(data_file, 'r') as fobj:
|
||||||
{'name': 'Duck Duck Go', 'url': 'https://duckduckgo.com/?q=', 'prefix': '/d'},
|
k8s_providers.extend(yaml.safe_load(fobj))
|
||||||
{'name': 'iMDB', 'url': 'https://www.imdb.com/find?q=', 'prefix': '/i'},
|
return jsonify({'providers': k8s_providers})
|
||||||
{'name': 'TheMovieDB', 'url': 'https://www.themoviedb.org/search?query=', 'prefix': '/m'},
|
|
||||||
{'name': 'Reddit', 'url': 'https://www.reddit.com/search?q=', 'prefix': '/r'},
|
|
||||||
{'name': 'Qwant', 'url': 'https://www.qwant.com/?q=', 'prefix': '/q'},
|
|
||||||
{'name': 'Soundcloud', 'url': 'https://soundcloud.com/search?q=', 'prefix': '/so'},
|
|
||||||
{'name': 'Spotify', 'url': 'https://open.spotify.com/search/results/', 'prefix': '/s'},
|
|
||||||
{'name': 'TheTVDB', 'url': 'https://www.thetvdb.com/search?query=', 'prefix': '/tv'},
|
|
||||||
{'name': 'Trakt', 'url': 'https://trakt.tv/search?query=', 'prefix': '/t'},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
@base.route('/apps.json')
|
@base.route('/apps.json')
|
||||||
|
|||||||
49
ohayodash/data/providers.yaml
Normal file
49
ohayodash/data/providers.yaml
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
- name: Allmusic
|
||||||
|
url: https://www.allmusic.com/
|
||||||
|
search: search/all/
|
||||||
|
prefix: /a
|
||||||
|
- name: Discogs
|
||||||
|
url: https://www.discogs.com/
|
||||||
|
search: search/?q=
|
||||||
|
prefix: /di
|
||||||
|
- name: DuckDuckGo
|
||||||
|
url: https://duckduckgo.com/
|
||||||
|
search: "?q="
|
||||||
|
prefix: /d
|
||||||
|
- name: Google
|
||||||
|
url: https://google.com/
|
||||||
|
search: search/?q=
|
||||||
|
prefix: /g
|
||||||
|
- name: iMDB
|
||||||
|
url: https://imbdb.com/
|
||||||
|
search: find?q=
|
||||||
|
prefix: /i
|
||||||
|
- name: TheMovieDB
|
||||||
|
url: https://www.themoviedb.org/
|
||||||
|
search: search/?query=
|
||||||
|
prefix: /m
|
||||||
|
- name: Reddit
|
||||||
|
url: https://www.reddit.com/
|
||||||
|
search: search?q=
|
||||||
|
prefix: /r
|
||||||
|
- name: Qwant
|
||||||
|
url: https://www.qwant.com/
|
||||||
|
search: "?q="
|
||||||
|
prefix: /q
|
||||||
|
- name: Soundcloud
|
||||||
|
url: https://soundcloud.com/
|
||||||
|
search: search?q=
|
||||||
|
prefix: /so
|
||||||
|
- name: Spotify
|
||||||
|
url: https://open.spotify.com/
|
||||||
|
search: search/results/
|
||||||
|
prefix: /s
|
||||||
|
- name: TheTVDB
|
||||||
|
url: https://www.thetvdb.com/
|
||||||
|
search: search?query=
|
||||||
|
prefix: /tv
|
||||||
|
- name: Trakt
|
||||||
|
url: https://trakt.tv/
|
||||||
|
search: search?query=
|
||||||
|
prefix: /t
|
||||||
@@ -1,6 +1,15 @@
|
|||||||
var sindex = 0;
|
var sindex = 0;
|
||||||
var cycle = false;
|
var cycle = false;
|
||||||
var sengine = "https://www.google.com/?q="; // Default search engine
|
var sengine = "https://www.google.com/search?q="; // Default search engine
|
||||||
|
var providers = [];
|
||||||
|
|
||||||
|
fetch('providers.json')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => storeProviders(data));
|
||||||
|
|
||||||
|
function storeProviders(data) {
|
||||||
|
providers = data['providers'];
|
||||||
|
}
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
var query = getParameterByName('q');
|
var query = getParameterByName('q');
|
||||||
@@ -16,33 +25,8 @@ function start() {
|
|||||||
function handleKeyPress(e) {
|
function handleKeyPress(e) {
|
||||||
var key = e.keyCode || e.which;
|
var key = e.keyCode || e.which;
|
||||||
var text = document.getElementById("keywords").value.replaceAll("+", "%2B");
|
var text = document.getElementById("keywords").value.replaceAll("+", "%2B");
|
||||||
var option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);
|
|
||||||
var subtext = text.substr(2 + option.length);
|
|
||||||
if (key == 13) { // Search functions
|
if (key == 13) { // Search functions
|
||||||
search(text);
|
search(text.trim());
|
||||||
}
|
|
||||||
if (key == 9) { // Tab Completion Functions
|
|
||||||
e.preventDefault();
|
|
||||||
e.stopPropagation();
|
|
||||||
if (text[0] === ';') {
|
|
||||||
switch (option) {
|
|
||||||
case 't':
|
|
||||||
var streamers = ['admiralbahroo', 'moonmoon_ow', 'witwix'];
|
|
||||||
if (!subtext || cycle) {
|
|
||||||
cycle = true;
|
|
||||||
if (sindex > streamers.length - 1) sindex = 0;
|
|
||||||
document.getElementById("keywords").value = ';t ' + streamers[sindex++];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (var streamer of streamers) {
|
|
||||||
if (subtext === streamer.substr(0, subtext.length)) {
|
|
||||||
document.getElementById("keywords").value = ';t ' + streamer;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (key == 32) { //Space to go to search
|
if (key == 32) { //Space to go to search
|
||||||
document.getElementById("keywords").focus();
|
document.getElementById("keywords").focus();
|
||||||
@@ -55,65 +39,17 @@ function search(text) {
|
|||||||
var option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);
|
var option = text.substr(1, text.indexOf(' ') - 1) || text.substr(1);
|
||||||
var subtext = text.substr(2 + option.length);
|
var subtext = text.substr(2 + option.length);
|
||||||
if (text[0] === '/') {
|
if (text[0] === '/') {
|
||||||
|
providers.every(function (item) {
|
||||||
|
if ('/' + option == item['prefix']) {
|
||||||
if (text.indexOf(' ') > -1) {
|
if (text.indexOf(' ') > -1) {
|
||||||
switch (option) {
|
window.location = item['url'] + item['search'] + subtext;
|
||||||
case "am":
|
|
||||||
window.location = "https://www.allmusic.com/search/all/" + subtext;
|
|
||||||
break;
|
|
||||||
case "d":
|
|
||||||
window.location = "https://duckduckgo.com/?q=" + subtext;
|
|
||||||
break;
|
|
||||||
case "di":
|
|
||||||
window.location = "https://www.discogs.com/search/?q=" + subtext;
|
|
||||||
break;
|
|
||||||
case "i":
|
|
||||||
window.location = "https://www.imdb.com/find?q=" + subtext;
|
|
||||||
break;
|
|
||||||
case "m":
|
|
||||||
window.location = "https://www.themoviedb.org/search?query=" + subtext;
|
|
||||||
break;
|
|
||||||
case "r":
|
|
||||||
window.location = "https://www.reddit.com/search?q=" + subtext;
|
|
||||||
break;
|
|
||||||
case "q":
|
|
||||||
window.location = "https://www.qwant.com/?q=" + subtext;
|
|
||||||
break;
|
|
||||||
case "so":
|
|
||||||
window.location = "https://soundcloud.com/search?q=" + subtext;
|
|
||||||
break;
|
|
||||||
case "s":
|
|
||||||
window.location = "https://open.spotify.com/search/results/" + subtext;
|
|
||||||
break;
|
|
||||||
case "t":
|
|
||||||
window.location = "https://trakt.tv/search?query=" + subtext;
|
|
||||||
break;
|
|
||||||
case "tv":
|
|
||||||
window.location = "https://www.thetvdb.com/search?query=" + subtext;
|
|
||||||
break;
|
|
||||||
case "y":
|
|
||||||
window.location = "https://www.youtube.com/results?search_query=" + subtext;
|
|
||||||
break;
|
|
||||||
case "g":
|
|
||||||
window.location = "https://www.google.com/?q=" + subtext;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
var option = text.substr(1);
|
window.location = item['url'] + subtext;
|
||||||
switch (option) {
|
|
||||||
case "d":
|
|
||||||
window.location = "https://www.duckduckgo.com";
|
|
||||||
break;
|
|
||||||
case "y":
|
|
||||||
window.location = "https://www.youtube.com";
|
|
||||||
break;
|
|
||||||
case "r":
|
|
||||||
window.location = "https://reddit.com";
|
|
||||||
break;
|
|
||||||
case "s":
|
|
||||||
window.location = "https://open.spotify.com";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
} else if (validURL(text)) {
|
} else if (validURL(text)) {
|
||||||
if (containsProtocol(text))
|
if (containsProtocol(text))
|
||||||
window.location = text;
|
window.location = text;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
flask==2.0.2
|
flask==2.2.3
|
||||||
kubernetes==21.7.0
|
kubernetes==26.1.0
|
||||||
pyyaml==6.0
|
pyyaml==6.0
|
||||||
gunicorn==20.1.0
|
gunicorn==20.1.0
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = ohayodash
|
name = ohayodash
|
||||||
version = 0.2.1
|
version = 0.4.0
|
||||||
description = A Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
description = A Kubernetes driven start page and dashboard. All configuration is done by standard Kubernetes objects and ConfigMaps.
|
||||||
long_description = file: README.md, LICENSE
|
long_description = file: README.md, LICENSE
|
||||||
license = MIT
|
license = MIT
|
||||||
@@ -13,6 +13,7 @@ classifiers =
|
|||||||
|
|
||||||
[options]
|
[options]
|
||||||
zip_safe = False
|
zip_safe = False
|
||||||
|
include_package_data = True
|
||||||
packages = ohayodash
|
packages = ohayodash
|
||||||
install_requires =
|
install_requires =
|
||||||
flask
|
flask
|
||||||
@@ -20,9 +21,12 @@ install_requires =
|
|||||||
pyyaml
|
pyyaml
|
||||||
gunicorn
|
gunicorn
|
||||||
|
|
||||||
|
[options.package_data]
|
||||||
|
ohayodash = data/*.yaml
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
format = wemake
|
format = wemake
|
||||||
ignore = E501,D,WPS226,WPS110, WPS210,WPS231
|
ignore = E501,D,WPS226,WPS110, WPS210,WPS231,WPS202
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
exclude = setup.py
|
exclude = setup.py
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user