Working Docker

This commit is contained in:
Pablo Ferreiro 2022-03-15 22:52:54 +01:00
parent c26e027c01
commit f0765e266c
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
18 changed files with 102 additions and 43 deletions

8
.dockerignore Normal file
View file

@ -0,0 +1,8 @@
node_modules
/.env
/.vscode
/vendor
/cache/latte/*
!/cache/latte/.gitkeep
/cache/api/*
!/cache/api/.gitkeep

15
Dockerfile Normal file
View file

@ -0,0 +1,15 @@
FROM php:8.0-apache
WORKDIR /var/www/html
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN apt update -y && apt install -y libzip-dev \
&& pecl install redis zip \
&& docker-php-ext-enable redis zip \
&& a2enmod rewrite headers
RUN ["mkdir", "/cache"]
RUN ["chown", "-R", "www-data:www-data", "/cache"]
COPY . .
RUN composer update \
&& composer install --no-interaction --optimize-autoloader --no-dev

8
components/form.latte Normal file
View file

@ -0,0 +1,8 @@
<form action="{path($path)}" method="POST">
{block fields}{/block}
<div class="field">
<div class="control">
<button class="button is-success" type="submit">Submit</button>
</div>
</div>
</form>

View file

@ -5,7 +5,6 @@
<meta property="og:title" content="ProxiTok" />
<meta property="og:description" content="Alternative frontend for TikTok" />
<meta property="og:type" content="website" />
<!-- <link rel="stylesheet" href="{path('/styles/vendor/fontawesome.min.css')}"> -->
<link rel="stylesheet" href="{path('/styles/vendor/bulma.min.css')}">
<title>{$title} - ProxiTok</title>
</head>

3
components/rss.latte Normal file
View file

@ -0,0 +1,3 @@
<a href="{path($_SERVER['REQUEST_URI'] . '/rss')}">
{include './icon.latte', icon: 'feed', text: 'RSS'}
</a>

View file

@ -1,14 +1,14 @@
<form action="{path('/settings/api')}" method="POST">
{embed '../form.latte', path: '/settings/api'}
{block fields}
<div class="field">
<label class="checkbox">
<input name="api-legacy" type="checkbox"
checked="{isset($_COOKIE['api-legacy']) && $_COOKIE['api-legacy'] === 'on' ? 'true' : 'false'}"
value="{isset($_COOKIE['api-legacy']) ? $_COOKIE['api-legacy'] : 'off'}">Enable legacy mode
</label>
</div>
<div class="field">
<div class="control">
<button class="button is-success" type="submit">Submit</button>
<label class="label">Legacy mode</label>
<div class="select">
<select name="api-legacy">
<option hidden disabled selected value> -- Select an option -- </option>
<option value="on">On</option>
<option value="off">Off</option>
</select>
</div>
</div>
</form>
{/block}
{/embed}

View file

@ -1,4 +1,5 @@
<form action="{path('/settings/proxy')}" method="POST">
{embed '../form.latte', path: '/settings/proxy'}
{block fields}
{foreach $proxy_elements as $proxy_element}
<div class="field">
<label class="label">{$proxy_element|firstUpper}</label>
@ -7,9 +8,5 @@
</div>
</div>
{/foreach}
<div class="field">
<div class="control">
<button class="button is-success" type="submit">Submit</button>
</div>
</div>
</form>
{/block}
{/embed}

34
docker-compose.yml Normal file
View file

@ -0,0 +1,34 @@
version: '3'
services:
web:
container_name: proxitok-web
build: .
ports:
- 8080:80
environment:
- LATTE_CACHE=/cache
- API_CACHE=redis
- REDIS_HOST=proxitok-redis
- REDIS_PORT=6379
- API_BROWSER_URL=http://proxitok-chrome:9515
volumes:
- proxitok-cache:/cache
depends_on:
- redis
- chrome
redis:
container_name: proxitok-redis
image: redis:6-alpine
command: redis-server --save 60 1 --loglevel warning
restart: unless-stopped
chrome:
container_name: proxitok-chrome
image: zenika/alpine-chrome:with-chromedriver
shm_size: 1g
ports:
- "9515:9515"
volumes:
proxitok-cache:

View file

@ -1,2 +0,0 @@
@import "./node_modules/@fortawesome/fontawesome-free/scss/fontawesome.scss";
@import "./node_modules/@fortawesome/fontawesome-free/scss/solid.scss";

View file

@ -2,11 +2,9 @@
"name": "proxitok-scss",
"private": true,
"scripts": {
"bulma": "sass --style=compressed bulma.scss ./styles/vendor/bulma.min.css",
"fa": "sass --style=compressed fontawesome.scss ./styles/vendor/fontawesome.min.css"
"bulma": "sass --style=compressed bulma.scss ../styles/vendor/bulma.min.css"
},
"dependencies": {
"@fortawesome/fontawesome-free": "^6.0.0",
"bulma": "^0.9.3",
"bulmaswatch": "^0.8.1",
"sass": "^1.46.0"

View file

@ -2,11 +2,6 @@
# yarn lockfile v1
"@fortawesome/fontawesome-free@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.0.0.tgz#6f3bd8e42997c7d536a1246877ed8bcd4f005a54"
integrity sha512-6LB4PYBST1Rx40klypw1SmSDArjFOcfBf2LeX9Zg5EKJT2eXiyiJq+CyBYKeXyK0sXS2FsCJWSPr/luyhuvh0Q==
anymatch@~3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -6,9 +6,9 @@
{block content}
<!-- Proxy settings -->
<p class="title">Proxy</p>
{include '../components/settings/proxy.latte'}
<hr />
<p class="title">Api</p>
{include '../components/settings/api.latte'}
<hr />
<p class="title">Proxy</p>
{include '../components/settings/proxy.latte'}
{/block}

View file

@ -1,10 +1,14 @@
{layout '../layouts/default.latte'}
{block header}
{if $feed->info->detail->profileThumb !== ''}
<figure class="figure is-96x96">
<img src="{path('/stream?url=' . urlencode($feed->info->detail->profileThumb))}" />
</figure>
{/if}
<p class="title">{$feed->info->detail->title}</p>
<p class="subtitle">{$feed->info->detail->desc}</p>
<p class="subtitle">{include '../components/rss.latte'}</p>
<p>Videos: {number($feed->info->stats->videoCount)} / Views: {number($feed->info->stats->viewCount)}</p>
<a href="{path('/tag/' . $feed->info->detail->title . '/rss')}">RSS</a>
{/block}
{block content}

View file

@ -2,7 +2,7 @@
{block header}
<p class="title">Trending</p>
<a href="{path('/trending/rss')}">RSS</a>
<p class="subtitle">{include '../components/rss.latte'}</p>
{/block}
{block content}

View file

@ -4,11 +4,11 @@
<figure class="figure is-96x96">
<img src="{path('/stream?url=' . urlencode($feed->info->detail->avatarThumb))}" />
</figure>
<p class="title">{$feed->info->detail->uniqueId}'s profile</p>
<p class="subtitle">{$feed->info->detail->signature}</p>
<p class="title">{$feed->info->detail->uniqueId}</p>
<p class="subtitle">{include '../components/rss.latte'}</p>
<p>{$feed->info->detail->signature}</p>
<p>Following: {number($feed->info->stats->followingCount)} / Followers: {number($feed->info->stats->followerCount)}</p>
<p>Hearts: {number($feed->info->stats->heartCount)} / Videos: {$feed->info->stats->videoCount}</p>
<a href="{path('/@' . $feed->info->detail->uniqueId . '/rss')}">RSS</a>
{/block}
{block content}

View file

@ -21,7 +21,7 @@
</div>
<div class="dropdown-menu" role="menu">
<div class="dropdown-content">
<a href="{path('/download?url=' . urlencode($item->video->playAddr) . '&id=' . $item->id . '&user=' . $item->author->uniqueId) . '&watermark='}" class="dropdown-item">Watermark</a>
<a href="{path('/download?url=' . urlencode($item->video->playAddr) . '&id=' . $item->id . '&user=' . $feed->info->detail->uniqueId) . '&watermark='}" class="dropdown-item">Watermark</a>
<a href="{path('/download?id=' . $item->id . '&user=' . $feed->info->detail->uniqueId)}" class="dropdown-item">No watermark</a>
</div>
</div>