Compare commits
	
		
			8 Commits
		
	
	
		
			809caa1027
			...
			1.0.0
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 215374167b | |||
| 77268ae92f | |||
| c42687a072 | |||
| ca16345374 | |||
| 3a3045be91 | |||
| 
						
						
							
						
						d40612af72
	
				 | 
					
					
						|||
| 
						
						
							
						
						18e8f93261
	
				 | 
					
					
						|||
| 56e5dfaa03 | 
@ -1,3 +1,11 @@
 | 
				
			|||||||
 | 
					## 1.0.0 / 2023-01-20 19:54+01:00
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					* Breaking
 | 
				
			||||||
 | 
					  * Due to major re-arranging and re-naming of the folder structure, tables also had to be renamed.
 | 
				
			||||||
 | 
					* Fixed
 | 
				
			||||||
 | 
					  * Sort form fields alphabetically (https://git.kucharczyk.xyz/lukas/timetracker/issues/39, https://git.kucharczyk.xyz/lukas/timetracker/issues/40)
 | 
				
			||||||
 | 
					  * Start session button starts different game than it says (#44)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 0.2.5 / 2023-01-18 17:01+01:00
 | 
					## 0.2.5 / 2023-01-18 17:01+01:00
 | 
				
			||||||
 | 
					
 | 
				
			||||||
* New
 | 
					* New
 | 
				
			||||||
 | 
				
			|||||||
@ -5,10 +5,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
:8000 {
 | 
					:8000 {
 | 
				
			||||||
    handle_path /static/* {
 | 
					    handle_path /static/* {
 | 
				
			||||||
        root * src/timetracker/static/
 | 
					        root * /usr/share/caddy
 | 
				
			||||||
        file_server
 | 
					        file_server
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    handle {
 | 
					    handle {
 | 
				
			||||||
        reverse_proxy :8001
 | 
					        reverse_proxy backend:8001
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										13
									
								
								Dockerfile
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								Dockerfile
									
									
									
									
									
								
							@ -2,11 +2,11 @@ FROM node as css
 | 
				
			|||||||
WORKDIR /app
 | 
					WORKDIR /app
 | 
				
			||||||
COPY . /app
 | 
					COPY . /app
 | 
				
			||||||
RUN npm install && \
 | 
					RUN npm install && \
 | 
				
			||||||
    npx tailwindcss -i ./src/input.css -o ./src/timetracker/games/static/base.css --minify
 | 
					    npx tailwindcss -i ./common/input.css -o ./static/base.css --minify
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM python:3.10.9-slim-bullseye
 | 
					FROM python:3.10.9-slim-bullseye
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ENV VERSION_NUMBER 0.2.5
 | 
					ENV VERSION_NUMBER 1.0.0
 | 
				
			||||||
ENV PROD 1
 | 
					ENV PROD 1
 | 
				
			||||||
ENV PYTHONUNBUFFERED=1
 | 
					ENV PYTHONUNBUFFERED=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -15,18 +15,13 @@ RUN apt update && \
 | 
				
			|||||||
    bash \
 | 
					    bash \
 | 
				
			||||||
    vim \
 | 
					    vim \
 | 
				
			||||||
    curl && \
 | 
					    curl && \
 | 
				
			||||||
    apt install -y debian-keyring debian-archive-keyring apt-transport-https && \
 | 
					 | 
				
			||||||
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg && \
 | 
					 | 
				
			||||||
    curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list && \
 | 
					 | 
				
			||||||
    apt update && \
 | 
					 | 
				
			||||||
    apt install caddy && \
 | 
					 | 
				
			||||||
    rm -rf /var/lib/apt/lists/*
 | 
					    rm -rf /var/lib/apt/lists/*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
RUN useradd -m --uid 1000 timetracker
 | 
					RUN useradd -m --uid 1000 timetracker
 | 
				
			||||||
WORKDIR /home/timetracker/app
 | 
					WORKDIR /home/timetracker/app
 | 
				
			||||||
COPY . /home/timetracker/app/
 | 
					COPY . /home/timetracker/app/
 | 
				
			||||||
RUN chown -R timetracker:timetracker /home/timetracker/app
 | 
					RUN chown -R timetracker:timetracker /home/timetracker/app
 | 
				
			||||||
COPY --from=css /app/src/timetracker/games/static/base.css /home/timetracker/app/src/timetracker/games/static/base.css
 | 
					COPY --from=css ./app/static/base.css /home/timetracker/app/static/base.css
 | 
				
			||||||
COPY entrypoint.sh /
 | 
					COPY entrypoint.sh /
 | 
				
			||||||
RUN chmod +x /entrypoint.sh
 | 
					RUN chmod +x /entrypoint.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -36,4 +31,4 @@ RUN pip install --no-cache-dir poetry
 | 
				
			|||||||
RUN poetry install --without dev
 | 
					RUN poetry install --without dev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EXPOSE 8000
 | 
					EXPOSE 8000
 | 
				
			||||||
ENTRYPOINT [ "/entrypoint.sh" ]
 | 
					CMD [ "/entrypoint.sh" ]
 | 
				
			||||||
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							@ -34,6 +34,9 @@ dumpgames:
 | 
				
			|||||||
loadplatforms:
 | 
					loadplatforms:
 | 
				
			||||||
	poetry run python manage.py loaddata platforms.yaml
 | 
						poetry run python manage.py loaddata platforms.yaml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					loadall:
 | 
				
			||||||
 | 
						poetry run python manage.py loaddata data.yaml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
loadsample:
 | 
					loadsample:
 | 
				
			||||||
	poetry run python manage.py loaddata sample.yaml
 | 
						poetry run python manage.py loaddata sample.yaml
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										17
									
								
								docker-compose.no-caddy.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								docker-compose.no-caddy.yml
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					services:
 | 
				
			||||||
 | 
					  timetracker:
 | 
				
			||||||
 | 
					    image: registry.kucharczyk.xyz/timetracker
 | 
				
			||||||
 | 
					    build:
 | 
				
			||||||
 | 
					      context: .
 | 
				
			||||||
 | 
					      dockerfile: Dockerfile
 | 
				
			||||||
 | 
					    container_name: timetracker
 | 
				
			||||||
 | 
					    environment:
 | 
				
			||||||
 | 
					      - TZ=Europe/Prague
 | 
				
			||||||
 | 
					      - CSRF_TRUSTED_ORIGINS="https://tracker.kucharczyk.xyz"
 | 
				
			||||||
 | 
					    user: "1000"
 | 
				
			||||||
 | 
					    # volumes:
 | 
				
			||||||
 | 
					    #   - "db:/home/timetracker/app/src/timetracker/db.sqlite3"
 | 
				
			||||||
 | 
					    ports:
 | 
				
			||||||
 | 
					      - "8000:8000"
 | 
				
			||||||
 | 
					    restart: unless-stopped
 | 
				
			||||||
@ -1,17 +1,28 @@
 | 
				
			|||||||
---
 | 
					---
 | 
				
			||||||
services:
 | 
					services:
 | 
				
			||||||
  timetracker:
 | 
					  backend:
 | 
				
			||||||
    image: registry.kucharczyk.xyz/timetracker
 | 
					    image: registry.kucharczyk.xyz/timetracker
 | 
				
			||||||
    build:
 | 
					    build:
 | 
				
			||||||
      context: .
 | 
					      context: .
 | 
				
			||||||
      dockerfile: Dockerfile
 | 
					      dockerfile: Dockerfile
 | 
				
			||||||
    container_name: timetracker
 | 
					 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      - TZ=Europe/Prague
 | 
					      - TZ=Europe/Prague
 | 
				
			||||||
      - CSRF_TRUSTED_ORIGINS="https://tracker.kucharczyk.xyz"
 | 
					      - CSRF_TRUSTED_ORIGINS="https://tracker.kucharczyk.xyz"
 | 
				
			||||||
    user: "1000"
 | 
					    user: "1000"
 | 
				
			||||||
    # volumes:
 | 
					    volumes:
 | 
				
			||||||
    #   - "db:/home/timetracker/app/src/timetracker/db.sqlite3"
 | 
					      - "static-files:/home/timetracker/app/static"
 | 
				
			||||||
 | 
					    restart: unless-stopped
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  frontend:
 | 
				
			||||||
 | 
					    image: caddy
 | 
				
			||||||
 | 
					    volumes:
 | 
				
			||||||
 | 
					      - "static-files:/usr/share/caddy"
 | 
				
			||||||
 | 
					      - "$PWD/Caddyfile:/etc/caddy/Caddyfile"
 | 
				
			||||||
    ports:
 | 
					    ports:
 | 
				
			||||||
      - "8000:8000"
 | 
					      - "8000:8000"
 | 
				
			||||||
    restart: unless-stopped
 | 
					    depends_on:
 | 
				
			||||||
 | 
					      - backend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					volumes:
 | 
				
			||||||
 | 
					  static-files:
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
				
			|||||||
@ -2,11 +2,10 @@
 | 
				
			|||||||
# Apply database migrations
 | 
					# Apply database migrations
 | 
				
			||||||
set -euo pipefail
 | 
					set -euo pipefail
 | 
				
			||||||
echo "Apply database migrations"
 | 
					echo "Apply database migrations"
 | 
				
			||||||
poetry run python src/timetracker/manage.py migrate
 | 
					poetry run python manage.py migrate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Collect static files"
 | 
					echo "Collect static files"
 | 
				
			||||||
poetry run python src/timetracker/manage.py collectstatic --clear --no-input
 | 
					poetry run python manage.py collectstatic --clear --no-input
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "Starting server"
 | 
					echo "Starting app"
 | 
				
			||||||
caddy start
 | 
					 | 
				
			||||||
poetry run python -m gunicorn --bind 0.0.0.0:8001 timetracker.asgi:application -k uvicorn.workers.UvicornWorker --access-logfile - --error-logfile -
 | 
					poetry run python -m gunicorn --bind 0.0.0.0:8001 timetracker.asgi:application -k uvicorn.workers.UvicornWorker --access-logfile - --error-logfile -
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,8 @@ from games.models import Game, Platform, Purchase, Session
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SessionForm(forms.ModelForm):
 | 
					class SessionForm(forms.ModelForm):
 | 
				
			||||||
 | 
					    purchase = forms.ModelChoiceField(queryset=Purchase.objects.order_by("game__name"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class Meta:
 | 
					    class Meta:
 | 
				
			||||||
        model = Session
 | 
					        model = Session
 | 
				
			||||||
        fields = [
 | 
					        fields = [
 | 
				
			||||||
@ -16,6 +18,9 @@ class SessionForm(forms.ModelForm):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PurchaseForm(forms.ModelForm):
 | 
					class PurchaseForm(forms.ModelForm):
 | 
				
			||||||
 | 
					    game = forms.ModelChoiceField(queryset=Game.objects.order_by("name"))
 | 
				
			||||||
 | 
					    platform = forms.ModelChoiceField(queryset=Platform.objects.order_by("name"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    class Meta:
 | 
					    class Meta:
 | 
				
			||||||
        model = Purchase
 | 
					        model = Purchase
 | 
				
			||||||
        fields = ["game", "platform", "date_purchased", "date_refunded"]
 | 
					        fields = ["game", "platform", "date_purchased", "date_refunded"]
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,7 @@
 | 
				
			|||||||
            {% if purchase %}<a class="dark:text-white hover:underline block" href="{% url 'list_sessions_by_game' purchase.game.id %}">See all platforms</a>{% endif %}
 | 
					            {% if purchase %}<a class="dark:text-white hover:underline block" href="{% url 'list_sessions_by_game' purchase.game.id %}">See all platforms</a>{% endif %}
 | 
				
			||||||
            {% endif %}
 | 
					            {% endif %}
 | 
				
			||||||
            {% if dataset.count >= 1 %}
 | 
					            {% if dataset.count >= 1 %}
 | 
				
			||||||
            <a class="clear-both" href="{% url 'start_session' dataset.last.purchase.id %}">
 | 
					            <a class="clear-both" href="{% url 'start_session' last.purchase.id %}">
 | 
				
			||||||
                <button type="button" title="Track last tracked" class="mt-10 py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg ">
 | 
					                <button type="button" title="Track last tracked" class="mt-10 py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg ">
 | 
				
			||||||
                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="self-center w-6 h-6 inline">
 | 
					                    <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="self-center w-6 h-6 inline">
 | 
				
			||||||
                        <path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" />
 | 
					                        <path stroke-linecap="round" stroke-linejoin="round" d="M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.348a1.125 1.125 0 010 1.971l-11.54 6.347a1.125 1.125 0 01-1.667-.985V5.653z" />
 | 
				
			||||||
 | 
				
			|||||||
@ -85,7 +85,8 @@ def list_sessions(request, filter="", purchase_id="", platform_id="", game_id=""
 | 
				
			|||||||
    # cannot use dataset[0] here because that might be only partial QuerySet
 | 
					    # cannot use dataset[0] here because that might be only partial QuerySet
 | 
				
			||||||
    context["last"] = Session.objects.all().order_by("timestamp_start").last()
 | 
					    context["last"] = Session.objects.all().order_by("timestamp_start").last()
 | 
				
			||||||
    # charts are always oldest->newest
 | 
					    # charts are always oldest->newest
 | 
				
			||||||
    context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start"))
 | 
					    if Session.objects.count() >= 2:
 | 
				
			||||||
 | 
					        context["chart"] = playtime_over_time_chart(dataset.order_by("timestamp_start"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return render(request, "list_sessions.html", context)
 | 
					    return render(request, "list_sessions.html", context)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
[tool.poetry]
 | 
					[tool.poetry]
 | 
				
			||||||
name = "timetracker"
 | 
					name = "timetracker"
 | 
				
			||||||
version = "0.2.5"
 | 
					version = "1.0.0"
 | 
				
			||||||
description = "A simple time tracker."
 | 
					description = "A simple time tracker."
 | 
				
			||||||
authors = ["Lukáš Kucharczyk <lukas@kucharczyk.xyz>"]
 | 
					authors = ["Lukáš Kucharczyk <lukas@kucharczyk.xyz>"]
 | 
				
			||||||
license = "GPL"
 | 
					license = "GPL"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
module.exports = {
 | 
					module.exports = {
 | 
				
			||||||
    darkMode: 'class',
 | 
					    darkMode: 'class',
 | 
				
			||||||
    content: ["./src/**/*.{html,js}"],
 | 
					    content: ["./**/*.{html,js}"],
 | 
				
			||||||
    theme: {
 | 
					    theme: {
 | 
				
			||||||
        fontFamily: {
 | 
					        fontFamily: {
 | 
				
			||||||
            sans: ['Inter', 'sans-serif'],
 | 
					            sans: ['Inter', 'sans-serif'],
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user