Compare commits
No commits in common. "0bea8c6e0b6e0b324d66a2200be611d7be107be4" and "73134ae8830cef455215e0661ed932ad98ccfd8f" have entirely different histories.
0bea8c6e0b
...
73134ae883
@ -2,44 +2,46 @@ name: Build and Publish Docker Image
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [main]
|
||||||
- main
|
tags: ['*'] # triggers on any tag push
|
||||||
tags:
|
|
||||||
- "v*.*.*"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Docker meta
|
steps:
|
||||||
id: meta
|
- name: Checkout repository
|
||||||
uses: docker/metadata-action@v5
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
images: ${{ secrets.REGISTRY }}/${{ secrets.USERNAME }}/ktv-ui
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest,enable={{is_default_branch}}
|
|
||||||
type=semver,pattern={{version}}
|
|
||||||
type=semver,pattern={{major}}.{{minor}}
|
|
||||||
type=semver,pattern={{major}}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
- name: Log in to Docker Registry
|
- name: Log in to Docker Registry
|
||||||
uses: docker/login-action@v3
|
run: echo "${{ secrets.PASSWORD }}" | docker login ${{ secrets.REGISTRY }} -u "${{ secrets.USERNAME }}" --password-stdin
|
||||||
with:
|
|
||||||
registry: ${{ secrets.REGISTRY }}
|
|
||||||
username: ${{ secrets.USERNAME }}
|
|
||||||
password: ${{ secrets.PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and Push Docker Images
|
||||||
uses: docker/build-push-action@v5
|
run: |
|
||||||
with:
|
IMAGE_NAME="ktv-ui"
|
||||||
context: .
|
REGISTRY="${{ secrets.REGISTRY }}"
|
||||||
push: true
|
USERNAME="${{ secrets.USERNAME }}"
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
IMAGE_LATEST="$REGISTRY/$USERNAME/$IMAGE_NAME:latest"
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
# Always build and tag as latest
|
||||||
|
echo "🔧 Building $IMAGE_LATEST"
|
||||||
|
docker build -t $IMAGE_LATEST .
|
||||||
|
|
||||||
|
echo "📤 Pushing $IMAGE_LATEST"
|
||||||
|
docker push $IMAGE_LATEST
|
||||||
|
|
||||||
|
# If this is a tag push, tag the image accordingly
|
||||||
|
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
|
||||||
|
GIT_TAG="${GITHUB_REF#refs/tags/}"
|
||||||
|
IMAGE_TAGGED="$REGISTRY/$USERNAME/$IMAGE_NAME:$GIT_TAG"
|
||||||
|
|
||||||
|
echo "🏷️ Also tagging as $IMAGE_TAGGED"
|
||||||
|
docker tag $IMAGE_LATEST $IMAGE_TAGGED
|
||||||
|
|
||||||
|
echo "📤 Pushing $IMAGE_TAGGED"
|
||||||
|
docker push $IMAGE_TAGGED
|
||||||
|
fi
|
||||||
|
11
app.py
11
app.py
@ -4,7 +4,7 @@ from flask_caching import Cache
|
|||||||
import requests.auth
|
import requests.auth
|
||||||
import os
|
import os
|
||||||
from lib.datetime import filter_accounts_next_30_days, filter_accounts_expired
|
from lib.datetime import filter_accounts_next_30_days, filter_accounts_expired
|
||||||
from lib.reqs import get_urls, get_user_accounts, add_user_account, delete_user_account, get_user_accounts_count, get_stream_names
|
from lib.reqs import get_urls, get_user_accounts, add_user_account, delete_user_account, get_user_accounts_count
|
||||||
from flask import send_from_directory
|
from flask import send_from_directory
|
||||||
import requests
|
import requests
|
||||||
import base64
|
import base64
|
||||||
@ -164,15 +164,6 @@ def delete_account():
|
|||||||
return redirect(url_for("user_accounts"))
|
return redirect(url_for("user_accounts"))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/get_stream_names", methods=["GET"])
|
|
||||||
def stream_names():
|
|
||||||
if not session.get("logged_in"):
|
|
||||||
return redirect(url_for("home"))
|
|
||||||
base_url = app.config["BASE_URL"]
|
|
||||||
stream_names = get_stream_names(base_url, session["auth_credentials"])
|
|
||||||
return jsonify(stream_names)
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/OCRupload', methods=['POST'])
|
@app.route('/OCRupload', methods=['POST'])
|
||||||
def OCRupload():
|
def OCRupload():
|
||||||
if 'image' not in request.files:
|
if 'image' not in request.files:
|
||||||
|
16
lib/reqs.py
16
lib/reqs.py
@ -105,19 +105,3 @@ def get_user_accounts_count(base_url: str, auth: str) -> int:
|
|||||||
response = requests.request("GET", url, headers=headers, data=payload)
|
response = requests.request("GET", url, headers=headers, data=payload)
|
||||||
res_json = json.loads(response.text)
|
res_json = json.loads(response.text)
|
||||||
return res_json['count']
|
return res_json['count']
|
||||||
|
|
||||||
|
|
||||||
def get_stream_names(base_url: str, auth: str) -> List[str]:
|
|
||||||
"""Get a list of stream names from the API.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
base_url (str): The base URL of the API.
|
|
||||||
auth (str): The authorization token.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
List[str]: A list of stream names.
|
|
||||||
"""
|
|
||||||
url = f"{base_url}/getStreamNames"
|
|
||||||
headers = {"Authorization": f"Basic {auth}"}
|
|
||||||
response = requests.get(url, headers=headers)
|
|
||||||
return json.loads(response.text)
|
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
<title>Add Account - KTVManager</title>
|
<title>Add Account - KTVManager</title>
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}" />
|
<link rel="stylesheet" href="{{ url_for('static', filename='styles.css') }}" />
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.5/awesomplete.min.css" />
|
|
||||||
<style>
|
<style>
|
||||||
/* Hide the spinner by default */
|
/* Hide the spinner by default */
|
||||||
#loadingSpinner,
|
#loadingSpinner,
|
||||||
@ -91,7 +90,6 @@
|
|||||||
<footer class="bg-dark text-white text-center py-3 mt-5">
|
<footer class="bg-dark text-white text-center py-3 mt-5">
|
||||||
<p></p>
|
<p></p>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/awesomplete/1.1.5/awesomplete.min.js"></script>
|
|
||||||
<script>
|
<script>
|
||||||
function showLoading() {
|
function showLoading() {
|
||||||
document.getElementById("submitButton").disabled = true;
|
document.getElementById("submitButton").disabled = true;
|
||||||
@ -103,17 +101,6 @@
|
|||||||
document.getElementById("ocrLoadingSpinner").style.display = "inline-block";
|
document.getElementById("ocrLoadingSpinner").style.display = "inline-block";
|
||||||
document.getElementById("ocrButtonText").textContent = "Processing...";
|
document.getElementById("ocrButtonText").textContent = "Processing...";
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener("DOMContentLoaded", function() {
|
|
||||||
var streamInput = document.getElementById("stream");
|
|
||||||
var awesomplete = new Awesomplete(streamInput);
|
|
||||||
|
|
||||||
fetch('/get_stream_names')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
awesomplete.list = data.map(item => item.streamName);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user