Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
11bac25
drawing quote with Playwright
arebaka Jun 6, 2023
9557510
drawing quote with Playwright
arebaka Jun 6, 2023
09722a4
optimize generation; add stress test
arebaka Jun 7, 2023
9823202
add async test using direct method
arebaka Jun 7, 2023
b615b2a
draw full quote with browser
arebaka Jun 7, 2023
36348f0
Merge branch 'html-render' of https://github.com/arebaka/quote-api in…
arebaka Jun 7, 2023
074a544
Merge branch 'optimize' into html-render
arebaka Jun 7, 2023
a922776
fix: using dedicated page for each async thread
arebaka Jun 7, 2023
d8b2405
resize images to 512px; detect color scheme
arebaka Jun 8, 2023
4a2b604
update tests
arebaka Jun 8, 2023
bad8f25
add reply messages; fix asset urls
arebaka Jun 8, 2023
7b79c31
add really avatars and initials
arebaka Jun 9, 2023
bcaceca
update tests; add html
arebaka Jun 9, 2023
362a341
add media
arebaka Jun 9, 2023
430c9f9
markup test with entities
arebaka Jun 9, 2023
a0b0734
fix: uploading avatars
arebaka Jun 10, 2023
26a43a6
allow line feeds
arebaka Jun 10, 2023
5d35358
render custom emoji
arebaka Jun 10, 2023
ec5af6a
allow emoji statuses
arebaka Jun 10, 2023
c034d97
allow stickers
arebaka Jun 11, 2023
30fe39b
hotfix of tests
arebaka Jun 11, 2023
470df7c
fix: from info in reply message; add png type
arebaka Jun 13, 2023
ac87509
refactor: cache views, separate css and html
arebaka Jun 13, 2023
cfa5537
style: float quotes to left
arebaka Jun 13, 2023
c2edbf4
style: pretty for stickers, minimize width
arebaka Jun 13, 2023
65ee633
feat: docker
arebaka Jun 13, 2023
f9d618f
allow .tgs lottie stickers
arebaka Jun 15, 2023
3a01dd6
allow video stickers and animations
arebaka Jun 15, 2023
ef64316
clean up
arebaka Jun 20, 2023
ce2af92
chore: update Docker
arebaka Jun 21, 2023
024ab36
0.14.0
LyoSU Jul 23, 2023
cc62794
drawing quote with Playwright
arebaka Jun 6, 2023
98f1bf2
draw full quote with browser
arebaka Jun 7, 2023
e22d1bc
drawing quote with Playwright
arebaka Jun 6, 2023
580b25c
optimize generation; add stress test
arebaka Jun 7, 2023
2c1c00e
add async test using direct method
arebaka Jun 7, 2023
c06af80
fix: using dedicated page for each async thread
arebaka Jun 7, 2023
7dbcd2c
resize images to 512px; detect color scheme
arebaka Jun 8, 2023
cb7cbfb
update tests
arebaka Jun 8, 2023
4134d29
add reply messages; fix asset urls
arebaka Jun 8, 2023
e3312c9
add really avatars and initials
arebaka Jun 9, 2023
e99e122
update tests; add html
arebaka Jun 9, 2023
5db0d21
add media
arebaka Jun 9, 2023
ba295d7
markup test with entities
arebaka Jun 9, 2023
f27c78d
fix: uploading avatars
arebaka Jun 10, 2023
4ab6367
allow line feeds
arebaka Jun 10, 2023
4804ce1
render custom emoji
arebaka Jun 10, 2023
f0ffdcd
allow emoji statuses
arebaka Jun 10, 2023
12afe67
allow stickers
arebaka Jun 11, 2023
e06b650
hotfix of tests
arebaka Jun 11, 2023
46fb958
fix: from info in reply message; add png type
arebaka Jun 13, 2023
9a272ae
refactor: cache views, separate css and html
arebaka Jun 13, 2023
7e921e1
style: float quotes to left
arebaka Jun 13, 2023
7c8bb35
style: pretty for stickers, minimize width
arebaka Jun 13, 2023
5aec951
feat: docker
arebaka Jun 13, 2023
4491dca
allow .tgs lottie stickers
arebaka Jun 15, 2023
9b2b75c
allow video stickers and animations
arebaka Jun 15, 2023
765db4a
clean up
arebaka Jun 20, 2023
2731eb8
chore: update Docker
arebaka Jun 21, 2023
f39179e
optimize: reuse open pages
arebaka May 26, 2024
8ef5ebb
Merge branch 'html-render' of https://github.com/arebaka/quote-api in…
arebaka May 26, 2024
10e5418
optimize: cache assets and images
arebaka May 27, 2024
0ac7b0e
fix: balance async test
arebaka May 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
14 changes: 6 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
FROM nikolaik/python-nodejs:python3.8-nodejs12 AS builder
FROM mcr.microsoft.com/playwright:v1.35.0-jammy

ENV NODE_WORKDIR /app
WORKDIR $NODE_WORKDIR
WORKDIR /app
COPY . /app

ADD . $NODE_WORKDIR
RUN apt-get update && apt-get install -y build-essential libvips libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev && rm -rf /var/lib/apt/lists/*

RUN apt-get update && apt-get install -y build-essential gcc wget git libvips && rm -rf /var/lib/apt/lists/*


RUN npm install canvas@2.6.1 && npm install # TODO: canvas crashes if installed via npm install from package.json
RUN npm install && npx playwright install
ENTRYPOINT [ "npm", "start" ]
9 changes: 7 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const path = require('path')
const logger = require('koa-logger')
const responseTime = require('koa-response-time')
const bodyParser = require('koa-bodyparser')
const ratelimit = require('koa-ratelimit')
const serve = require('koa-static')
const mount = require('koa-mount')
const Router = require('koa-router')
const Koa = require('koa')

Expand All @@ -10,12 +13,14 @@ const app = new Koa()
app.use(logger())
app.use(responseTime())
app.use(bodyParser())
app.use(mount('/assets', serve(path.resolve(__dirname, 'assets'), { maxAge: 1000 * 3600 * 4, immutable: true })))
app.use(mount('/cache', serve(path.resolve(__dirname, 'cache'), { maxAge: 1000 * 3600 * 4, immutable: true })))

const ratelimitВb = new Map()
const ratelimitDb = new Map()

app.use(ratelimit({
driver: 'memory',
db: ratelimitВb,
db: ratelimitDb,
duration: 1000 * 55,
errorMessage: {
ok: false,
Expand Down
Binary file added assets/pattern_02_alpha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/reset.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ version: '3'

services:
api:
build:
context: .
build: .
env_file: .env
restart: always
logging:
Expand All @@ -13,11 +12,10 @@ services:
max-file: "3"
networks:
- quotly
command: node index.js
ports:
- 127.0.0.1:4888:4888
- ${PORT}:${PORT}


networks:
quotly:
external: true
external: true
Loading