Compare commits
No commits in common. "master" and "8584ee1bfe946badfd04eed69a07d0f7a72bad13" have entirely different histories.
master
...
8584ee1bfe
@ -1,5 +0,0 @@
|
|||||||
__pycache__
|
|
||||||
venv
|
|
||||||
surprise.txt
|
|
||||||
backend/static/main.js
|
|
||||||
frontend/elm-stuff
|
|
||||||
21
Dockerfile
21
Dockerfile
@ -1,19 +1,10 @@
|
|||||||
FROM python:3-alpine
|
FROM xxx
|
||||||
|
|
||||||
ENV SURPRISE_ASSET_DIR=/assets
|
# Install flask and elm
|
||||||
ENV ELM_VERSION=0.19.1
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
|
|
||||||
COPY backend backend
|
# Copy files
|
||||||
COPY frontend frontend
|
|
||||||
|
|
||||||
ADD https://github.com/elm/compiler/releases/download/$ELM_VERSION/binary-for-linux-64-bit.gz elm.gz
|
# Compile elm
|
||||||
RUN gunzip elm.gz && \
|
|
||||||
chmod +x elm && \
|
# Run flask
|
||||||
mv elm /bin/elm
|
|
||||||
RUN cd frontend && \
|
|
||||||
elm make src/Main.elm --optimize --output=../backend/static/main.js
|
|
||||||
|
|
||||||
WORKDIR backend
|
|
||||||
RUN pip install -r requirements.pip
|
|
||||||
ENTRYPOINT ["flask", "run", "-h", "0.0.0.0"]
|
|
||||||
|
|||||||
40
README.md
40
README.md
@ -2,45 +2,5 @@
|
|||||||
|
|
||||||
This is a web application for revealing a surprise at a given time.
|
This is a web application for revealing a surprise at a given time.
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Two pages are served:
|
|
||||||
|
|
||||||
1. `/` - The index page polls the backend every second and displays the image
|
|
||||||
asset corresponding to the state of the surprise with a countdown if applicable.
|
|
||||||
2. `/set-surprise` - Select and POST the surprise to the backend (password protected).
|
|
||||||
|
|
||||||
The surprise can have the following states:
|
|
||||||
|
|
||||||
- `_null` - The surprise is not set.
|
|
||||||
- `_secret` - The surprise is set but not yet revealed.
|
|
||||||
- `<value>` - The surprise is set and revealed.
|
|
||||||
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Environment variables:
|
|
||||||
|
|
||||||
- `SURPRISE_TITLE` - Page title
|
|
||||||
- `SURPRISE_STORE_FILE` - File name to store surprise value.
|
|
||||||
- `SURPRISE_SECRET` - Password for setting the surprise.
|
|
||||||
- `SURPRISE_ASSET_DIR` - Directory of image assets that corresponds to surprise
|
|
||||||
state/values. The set of possible surprise values are parsed from the basename
|
|
||||||
of the asset files. The `_null` and `_secret` states may be overridden.
|
|
||||||
- `SURPRISE_REVEAL_DATETIME` - Datetime for reveal.
|
|
||||||
|
|
||||||
|
|
||||||
## Build
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker build -t surprise-countdown .
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Run gender reveal example
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ docker run -e SURPRISE_SECRET=hunter2 -p 5000:5000 -v $(pwd)/surprise-assets/gender-reveal:/assets:ro surprise-countdown
|
|
||||||
```
|
|
||||||
|
|
||||||
Then browse to [localhost:5000](localhost:5000).
|
|
||||||
|
|||||||
@ -64,7 +64,7 @@ update msg model =
|
|||||||
|
|
||||||
subscriptions : Model -> Sub Msg
|
subscriptions : Model -> Sub Msg
|
||||||
subscriptions model =
|
subscriptions model =
|
||||||
Time.every 1000 FetchSurprise
|
Time.every 980 FetchSurprise
|
||||||
|
|
||||||
|
|
||||||
-- VIEW
|
-- VIEW
|
||||||
|
|||||||
BIN
recording.gif
BIN
recording.gif
Binary file not shown.
|
Before Width: | Height: | Size: 3.0 MiB |
Loading…
x
Reference in New Issue
Block a user