7 Commits
2.3.0 ... 0.4.3

Author SHA1 Message Date
eedf2f83f0 Cargo form apt
Some checks failed
release-tag / release-image (push) Has been cancelled
2024-07-01 22:06:55 +02:00
1c7b246252 New Rust
Some checks failed
release-tag / release-image (push) Failing after 3m56s
2024-07-01 21:56:06 +02:00
709fc3b1a4 fix container
Some checks failed
release-tag / release-image (push) Has been cancelled
2024-07-01 21:35:57 +02:00
0988d53231 Bump versions and remove sentry
Some checks failed
release-tag / release-image (push) Failing after 4m26s
2024-07-01 21:10:07 +02:00
Marijn Doeve
02d225f2b2 Update dependencies
All checks were successful
release-nightly / release-image (push) Successful in 21m55s
2024-04-12 11:19:52 +02:00
89613e7b2a Update deps, makefile and compose config
All checks were successful
release-nightly / release-image (push) Successful in 18m52s
2023-09-24 21:20:37 +02:00
82f3f33478 Better css
Some checks failed
release-nightly / release-image (push) Has been cancelled
release-tag / release-image (push) Failing after 19m18s
2023-09-12 23:42:51 +02:00
13 changed files with 973 additions and 821 deletions

View File

@@ -1,54 +0,0 @@
name: release-nightly
on:
push:
branches: [ main ]
jobs:
release-image:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
env:
DOCKER_LATEST: nightly
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # all history for all branches and tags
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v2
- name: Login to Container Registry
uses: docker/login-action@v2
with:
registry: gitea.marijndoeve.nl
username: ${{ gitea.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
env:
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119
IMAGE_NAME: gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }}
with:
context: .
file: ./Containerfile
platforms: |
linux/arm/v7
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.DOCKER_LATEST }}
# cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:${{ env.DOCKER_LATEST }}
# cache-to: type:inline
# cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache
# cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max

View File

@@ -3,7 +3,7 @@ name: release-tag
on: on:
push: push:
tags: tags:
- '*' - "*"
jobs: jobs:
release-image: release-image:
@@ -40,7 +40,7 @@ jobs:
- name: Build and push - name: Build and push
uses: docker/build-push-action@v4 uses: docker/build-push-action@v4
env: env:
ACTIONS_RUNTIME_TOKEN: '' # See https://gitea.com/gitea/act_runner/issues/119 ACTIONS_RUNTIME_TOKEN: "" # See https://gitea.com/gitea/act_runner/issues/119
IMAGE_NAME: gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }} IMAGE_NAME: gitea.marijndoeve.nl/marijn/${{ steps.meta.outputs.REPO_NAME }}
with: with:
context: . context: .
@@ -62,10 +62,10 @@ jobs:
DOCKER_COMPOSE: IMAGE_TAG=${{ gitea.ref_name }} docker compose --ansi=never -f=compose.yaml -f=compose.prod.yaml DOCKER_COMPOSE: IMAGE_TAG=${{ gitea.ref_name }} docker compose --ansi=never -f=compose.yaml -f=compose.prod.yaml
uses: https://github.com/appleboy/ssh-action@master uses: https://github.com/appleboy/ssh-action@master
with: with:
host: ${{ secrets.HOST }} host: ${{ vars.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ vars.USERNAME }}
key: ${{ secrets.KEY }} key: ${{ secrets.KEY }}
port: ${{ secrets.PORT }} port: ${{ vars.PORT }}
script: | script: |
cd /opt/projectorpi-web cd /opt/projectorpi-web
${{ env.DOCKER_COMPOSE }} pull ${{ env.DOCKER_COMPOSE }} pull

View File

@@ -2,14 +2,14 @@
# See https://pre-commit.com/hooks.html for more hooks # See https://pre-commit.com/hooks.html for more hooks
repos: repos:
- repo: https://github.com/pre-commit/pre-commit-hooks - repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0 rev: v4.6.0
hooks: hooks:
- id: trailing-whitespace - id: trailing-whitespace
- id: end-of-file-fixer - id: end-of-file-fixer
- id: check-yaml - id: check-yaml
- id: check-added-large-files - id: check-added-large-files
- repo: https://github.com/python-poetry/poetry - repo: https://github.com/python-poetry/poetry
rev: 1.5.0 # add version here rev: 1.8.0 # add version here
hooks: hooks:
- id: poetry-check - id: poetry-check
- id: poetry-lock - id: poetry-lock
@@ -23,6 +23,6 @@ repos:
"--without-hashes", "--without-hashes",
] ]
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 23.3.0 rev: 24.4.2
hooks: hooks:
- id: black - id: black

View File

@@ -1,8 +1,8 @@
FROM docker.io/python:3.11-slim AS base FROM docker.io/python:3.12-slim AS base
WORKDIR /app WORKDIR /app
FROM base as dev FROM base AS dev
RUN pip3 install poetry RUN pip3 install poetry
@@ -10,14 +10,16 @@ ENV POETRY_VIRTUALENVS_IN_PROJECT=true
CMD [ "poetry", "run", "uvicorn", "--app-dir", "projectorpi_web", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"] CMD [ "poetry", "run", "uvicorn", "--app-dir", "projectorpi_web", "app:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
FROM base as prod FROM base AS prod
ADD requirements.txt ./ ADD requirements.txt ./
RUN apt-get update && apt-get install -y build-essential \ RUN apt-get update && apt-get install -y build-essential cargo \
&& pip3 install --no-cache --upgrade pip \ && pip3 install --no-cache --upgrade pip \
&& pip3 install --no-cache -r requirements.txt \ && pip3 install --no-cache -r requirements.txt \
&& apt-get remove -y build-essential && rm /usr/local/bin/cargo \
&& apt-get remove -y build-essential cargo
ADD projectorpi_web ./projectorpi_web ADD projectorpi_web ./projectorpi_web

3
Makefile Normal file
View File

@@ -0,0 +1,3 @@
.PHONY: prod
prod:
docker compose -f compose.yaml compose.prod.yaml up -d

View File

@@ -1,3 +1,4 @@
services: services:
app: app:
image: gitea.marijndoeve.nl/marijn/projectorpi-web:${IMAGE_TAG:-latest} image: gitea.marijndoeve.nl/marijn/projectorpi-web:${IMAGE_TAG:-latest}
restart: always

1506
poetry.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
__version__ = "0.2.0" __version__ = "0.4.0"

View File

@@ -1,18 +1,9 @@
from fastapi import FastAPI, Path, HTTPException, status from fastapi import FastAPI, Path, HTTPException, status
from fastapi.responses import RedirectResponse, FileResponse from fastapi.responses import FileResponse
from projectorpi.cli import ProjectorSerial, ExtronSerial from projectorpi import ProjectorSerial, ExtronSerial
from pydantic import BaseModel from pydantic import BaseModel
from time import sleep from time import sleep
from typing import Optional from typing import Optional
import sentry_sdk
sentry_sdk.init(
dsn="https://8dce3a0f69f643c0a3547b8baf19d00b@sentry.marijndoeve.nl/3",
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
# We recommend adjusting this value in production,
traces_sample_rate=1.0,
)
app = FastAPI() app = FastAPI()
@@ -27,7 +18,7 @@ class Response(BaseModel):
@app.get("/") @app.get("/")
async def index() -> RedirectResponse: async def index() -> FileResponse:
return FileResponse("projectorpi_web/index.html") return FileResponse("projectorpi_web/index.html")
# return RedirectResponse("/docs", HTTPStatus.MOVED_PERMANENTLY) # return RedirectResponse("/docs", HTTPStatus.MOVED_PERMANENTLY)

View File

@@ -1,22 +1,99 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head></head> <head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
#top {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(7, 1fr);
column-gap: normal;
justify-items: center;
}
#bottom {
display: grid;
grid-template: auto / repeat(4, 1fr);
justify-items: center;
}
.remote-button {
width: 70px;
height: 70px;
font-size: 50px;
}
#pwr {
grid-area: 1 / 3;
}
[data-direction="up"] {
grid-area: 2 / 2;
}
[data-direction="down"] {
grid-area: 4 / 2;
}
[data-direction="left"] {
grid-area: 3 / 1;
}
[data-direction="right"] {
grid-area: 3 / 3;
}
[data-direction="enter"] {
grid-area: 3 / 2;
}
[data-direction="menu"] {
grid-area: 5 / 1;
}
[data-direction="vol_up"] {
grid-area: 6 / 2;
}
[data-direction="vol_down"] {
grid-area: 7 / 2;
}
</style>
</head>
<body> <body>
<main> <main>
<button class="remote-button" data-direction="up">UP</button> <div id="top">
<button class="remote-button" data-direction="right">RIGHT</button> <button class="remote-button" data-direction="up">🔼</button>
<button class="remote-button" data-direction="down">DOWN</button> <button class="remote-button" data-direction="right">▶️</button>
<button class="remote-button" data-direction="left">LEFT</button> <button class="remote-button" data-direction="down">🔽</button>
<button class="remote-button" data-direction="enter">ENTER</button> <button class="remote-button" data-direction="left">◀️</button>
<button class="remote-button" data-direction="menu">MENU</button> <button class="remote-button" data-direction="enter">🆗</button>
<button class="remote-button" data-direction="vol_up">VOL UP</button> <button class="remote-button" data-direction="menu">↩️</button>
<button class="remote-button" data-direction="vol_down">VOL DOWN</button> <button class="remote-button" data-direction="vol_up">⏫️</button>
<button class="remote-button" data-direction="vol_down">⏬️</button>
<button class="remote-button" id="pwr">⏹️</button></div>
<div id="bottom">
<button class="remote-button" data-number="1">1</button>
<button class="remote-button" data-number="2">2</button>
<button class="remote-button" data-number="3">3</button>
<button class="remote-button" data-number="4">4</button>
</div>
</main> </main>
<script> <script>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
document.addEventListener('click', (e) => { document.addEventListener('click', (e) => {
let direction = e.target.dataset.direction let direction = e.target.dataset.direction
let number = e.target.dataset.number
if (direction) {
fetch(`/control/${direction}`, {method: 'POST'}) fetch(`/control/${direction}`, {method: 'POST'})
}
if (number) {
fetch(`/select/${number}`, {method: 'POST'})
}
if (e.target.id === 'pwr') {
fetch('/sleep', {method: 'POST'})
}
}); });
}) })
</script> </script>

View File

@@ -1,15 +1,15 @@
[tool.poetry] [tool.poetry]
name = "projectorpi-web" name = "projectorpi-web"
version = "0.2.0" version = "0.4.0"
description = "" description = ""
authors = ["Marijn Doeve <marijn@doeve.me>"] authors = ["Marijn Doeve <marijn@doeve.me>"]
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.9" python = "^3.9"
fastapi = {extras = ["all"], version = "^0.101.0"} fastapi = { extras = ["all"], version = "^0.111.0" }
pydantic = "^2.0.0" pydantic = "^2.8.0"
projectorpi = {version = "^0.3.0", source = "gitea"} projectorpi = { version = "^0.4.1", source = "gitea" }
sentry-sdk = {extras = ["fastapi"], version = "^1.25.0"} uvicorn = "^0.30.1"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
mypy = "^1.3.0" mypy = "^1.3.0"

View File

@@ -1,41 +1,45 @@
--extra-index-url https://gitea.marijndoeve.nl/api/packages/Marijn/pypi/simple --extra-index-url https://gitea.marijndoeve.nl/api/packages/Marijn/pypi/simple
annotated-types==0.5.0 ; python_version >= "3.9" and python_version < "4.0" annotated-types==0.7.0 ; python_version >= "3.9" and python_version < "4.0"
anyio==4.0.0 ; python_version >= "3.9" and python_version < "4.0" anyio==4.4.0 ; python_version >= "3.9" and python_version < "4.0"
certifi==2023.7.22 ; python_version >= "3.9" and python_version < "4.0" certifi==2024.6.2 ; python_version >= "3.9" and python_version < "4.0"
click==8.1.7 ; python_version >= "3.9" and python_version < "4.0" click==8.1.7 ; python_version >= "3.9" and python_version < "4.0"
colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and platform_system == "Windows" colorama==0.4.6 ; python_version >= "3.9" and python_version < "4.0" and (sys_platform == "win32" or platform_system == "Windows")
dnspython==2.4.2 ; python_version >= "3.9" and python_version < "4.0" dnspython==2.6.1 ; python_version >= "3.9" and python_version < "4.0"
email-validator==2.0.0.post2 ; python_version >= "3.9" and python_version < "4.0" email-validator==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
exceptiongroup==1.1.3 ; python_version >= "3.9" and python_version < "3.11" exceptiongroup==1.2.1 ; python_version >= "3.9" and python_version < "3.11"
fastapi==0.101.1 ; python_version >= "3.9" and python_version < "4.0" fastapi-cli==0.0.4 ; python_version >= "3.9" and python_version < "4.0"
fastapi[all]==0.101.1 ; python_version >= "3.9" and python_version < "4.0" fastapi[all]==0.111.0 ; python_version >= "3.9" and python_version < "4.0"
h11==0.14.0 ; python_version >= "3.9" and python_version < "4.0" h11==0.14.0 ; python_version >= "3.9" and python_version < "4.0"
httpcore==0.17.3 ; python_version >= "3.9" and python_version < "4.0" httpcore==1.0.5 ; python_version >= "3.9" and python_version < "4.0"
httptools==0.6.0 ; python_version >= "3.9" and python_version < "4.0" httptools==0.6.1 ; python_version >= "3.9" and python_version < "4.0"
httpx==0.24.1 ; python_version >= "3.9" and python_version < "4.0" httpx==0.27.0 ; python_version >= "3.9" and python_version < "4.0"
idna==3.4 ; python_version >= "3.9" and python_version < "4.0" idna==3.7 ; python_version >= "3.9" and python_version < "4.0"
itsdangerous==2.1.2 ; python_version >= "3.9" and python_version < "4.0" itsdangerous==2.2.0 ; python_version >= "3.9" and python_version < "4.0"
jinja2==3.1.2 ; python_version >= "3.9" and python_version < "4.0" jinja2==3.1.4 ; python_version >= "3.9" and python_version < "4.0"
markupsafe==2.1.3 ; python_version >= "3.9" and python_version < "4.0" markdown-it-py==3.0.0 ; python_version >= "3.9" and python_version < "4.0"
orjson==3.9.5 ; python_version >= "3.9" and python_version < "4.0" markupsafe==2.1.5 ; python_version >= "3.9" and python_version < "4.0"
projectorpi==0.3.0 ; python_version >= "3.9" and python_version < "4.0" mdurl==0.1.2 ; python_version >= "3.9" and python_version < "4.0"
pydantic-core==2.6.3 ; python_version >= "3.9" and python_version < "4.0" orjson==3.10.5 ; python_version >= "3.9" and python_version < "4.0"
pydantic-extra-types==2.1.0 ; python_version >= "3.9" and python_version < "4.0" projectorpi==0.4.1 ; python_version >= "3.9" and python_version < "4.0"
pydantic-settings==2.0.3 ; python_version >= "3.9" and python_version < "4.0" pydantic-core==2.20.0 ; python_version >= "3.9" and python_version < "4.0"
pydantic==2.3.0 ; python_version >= "3.9" and python_version < "4.0" pydantic-extra-types==2.8.2 ; python_version >= "3.9" and python_version < "4.0"
pydantic-settings==2.3.4 ; python_version >= "3.9" and python_version < "4.0"
pydantic==2.8.0 ; python_version >= "3.9" and python_version < "4.0"
pygments==2.18.0 ; python_version >= "3.9" and python_version < "4.0"
pyserial==3.5 ; python_version >= "3.9" and python_version < "4.0" pyserial==3.5 ; python_version >= "3.9" and python_version < "4.0"
python-dotenv==1.0.0 ; python_version >= "3.9" and python_version < "4.0" python-dotenv==1.0.1 ; python_version >= "3.9" and python_version < "4.0"
python-multipart==0.0.6 ; python_version >= "3.9" and python_version < "4.0" python-multipart==0.0.9 ; python_version >= "3.9" and python_version < "4.0"
pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "4.0" pyyaml==6.0.1 ; python_version >= "3.9" and python_version < "4.0"
sentry-sdk==1.30.0 ; python_version >= "3.9" and python_version < "4.0" rich==13.7.1 ; python_version >= "3.9" and python_version < "4.0"
sentry-sdk[fastapi]==1.30.0 ; python_version >= "3.9" and python_version < "4.0" shellingham==1.5.4 ; python_version >= "3.9" and python_version < "4.0"
sniffio==1.3.0 ; python_version >= "3.9" and python_version < "4.0" sniffio==1.3.1 ; python_version >= "3.9" and python_version < "4.0"
starlette==0.27.0 ; python_version >= "3.9" and python_version < "4.0" starlette==0.37.2 ; python_version >= "3.9" and python_version < "4.0"
typing-extensions==4.7.1 ; python_version >= "3.9" and python_version < "4.0" typer==0.12.3 ; python_version >= "3.9" and python_version < "4.0"
ujson==5.8.0 ; python_version >= "3.9" and python_version < "4.0" typing-extensions==4.12.2 ; python_version >= "3.9" and python_version < "4.0"
urllib3==2.0.4 ; python_version >= "3.9" and python_version < "4.0" ujson==5.10.0 ; python_version >= "3.9" and python_version < "4.0"
uvicorn[standard]==0.23.2 ; python_version >= "3.9" and python_version < "4.0" uvicorn==0.30.1 ; python_version >= "3.9" and python_version < "4.0"
uvloop==0.17.0 ; (sys_platform != "win32" and sys_platform != "cygwin") and platform_python_implementation != "PyPy" and python_version >= "3.9" and python_version < "4.0" uvicorn[standard]==0.30.1 ; python_version >= "3.9" and python_version < "4.0"
watchfiles==0.20.0 ; python_version >= "3.9" and python_version < "4.0" uvloop==0.19.0 ; (sys_platform != "win32" and sys_platform != "cygwin") and platform_python_implementation != "PyPy" and python_version >= "3.9" and python_version < "4.0"
websockets==11.0.3 ; python_version >= "3.9" and python_version < "4.0" watchfiles==0.22.0 ; python_version >= "3.9" and python_version < "4.0"
websockets==12.0 ; python_version >= "3.9" and python_version < "4.0"

View File

@@ -1,5 +1,5 @@
from projectorpi_web import __version__ from projectorpi_web import __version__
def test_version(): def test_version() -> None:
assert __version__ == "0.1.0" assert __version__ == "0.4.0"