diff --git a/.env.example b/.env.example index e968936..60cd9e1 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ # Base URL of the backend HTTP API. -VITE_API_BASE=https://localhost:3000 +VITE_API_BASE=http://localhost:3000 # Base URL of the backend websocket. Optional: when omitted it is derived # from VITE_API_BASE by swapping the protocol (https -> wss). -VITE_WS_BASE=wss://localhost:3000 +VITE_WS_BASE=ws://localhost:3000 diff --git a/.gitea/workflows/build-and-deploy.yml b/.gitea/workflows/build-and-deploy.yml new file mode 100644 index 0000000..7b7fa7a --- /dev/null +++ b/.gitea/workflows/build-and-deploy.yml @@ -0,0 +1,59 @@ +name: Build and Deploy + +on: + push: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + run: | + git clone ${{ github.server_url }}/${{ github.repository }}.git . + git checkout ${{ github.sha }} + + - name: Login to Gitea Registry + run: | + echo "${{ secrets.REGISTRY_PASSWORD }}" | \ + docker login https://gitea.johannesbot.de -u ${{ secrets.REGISTRY_USER }} --password-stdin + + - name: Build Image + run: docker build -t gitea.johannesbot.de/johannesbot/mc-computer-craft-api-frontend:latest . + + - name: Push Image + run: docker push gitea.johannesbot.de/johannesbot/mc-computer-craft-api-frontend:latest + + deploy: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Create deployment directory + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_PASSWORD }} + port: ${{ secrets.SSH_PORT || 22 }} + script: mkdir -p /home/${{ secrets.SSH_USER }}/mc-computer-craft-api-frontend + + - name: Deploy via SSH + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + password: ${{ secrets.SSH_PASSWORD }} + port: ${{ secrets.SSH_PORT || 22 }} + script: | + cd /home/${{ secrets.SSH_USER }}/mc-computer-craft-api + # Login as root/sudo to ensure we can pull + echo "${{ secrets.REGISTRY_PASSWORD }}" | sudo docker login https://gitea.johannesbot.de -u ${{ secrets.REGISTRY_USER }} --password-stdin + sudo docker compose pull + sudo docker compose up -d --remove-orphans + sudo docker image prune -f + + diff --git a/src/api/types.ts b/src/api/types.ts index d3ca865..5ca2877 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -6,6 +6,8 @@ export interface LiveItem { mod: string; amount: number; updatedAt: string; + /** Optional icon URL served by the backend (e.g. "/api/icon/minecraft/iron_ingot.png"). */ + icon?: string | null; } export interface ModInfo { diff --git a/src/components/FilterBar.vue b/src/components/FilterBar.vue index 948d0da..d8a43a6 100644 --- a/src/components/FilterBar.vue +++ b/src/components/FilterBar.vue @@ -49,6 +49,7 @@ function onModChange(event: Event): void { function toggleOrder(): void { emit('update', { order: props.filters.order === 'asc' ? 'desc' : 'asc' }); } +