Internal fixes and cleanup

This commit is contained in:
Pablo Ferreiro 2022-11-04 20:08:19 +01:00
parent 1176bc35fe
commit 94da0e46ac
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
30 changed files with 128 additions and 113 deletions

View file

@ -1,7 +1,7 @@
<?php
namespace App\Constants;
class CacheMethods {
abstract class CacheMethods {
const JSON = 'json';
const REDIS = 'redis';
}

View file

@ -2,7 +2,6 @@
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\Wrappers;
use App\Models\FeedTemplate;
@ -11,8 +10,7 @@ class DiscoverController {
$api = Wrappers::api();
$feed = $api->discover();
if ($feed->meta->success) {
$latte = Wrappers::latte();
$latte->render(Misc::getView('discover'), new FeedTemplate('Discover', $feed));
Wrappers::latte('discover', new FeedTemplate('Discover', $feed));
} else {
ErrorHandler::showMeta($feed->meta);
}

View file

@ -2,7 +2,6 @@
namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\Wrappers;
use App\Models\VideoTemplate;
@ -13,8 +12,7 @@ class EmbedController {
$video->feed();
if ($video->ok()) {
$data = $video->getFull();
$latte = Wrappers::latte();
$latte->render(Misc::getView('video'), new VideoTemplate($data->feed->items[0], $data->info->detail, true));
Wrappers::latte('video', new VideoTemplate($data->feed->items[0], $data->info->detail, true));
} else {
ErrorHandler::showMeta($video->error());
}

View file

@ -15,8 +15,7 @@ class MusicController {
$music->feed($cursor);
if ($music->ok()) {
$data = $music->getFull();
$latte = Wrappers::latte();
$latte->render(Misc::getView('music'), new FullTemplate('Music', $data));
Wrappers::latte('music', new FullTemplate('Music', $data));
} else {
ErrorHandler::showMeta($music->error());
}

View file

@ -8,8 +8,7 @@ use App\Models\SettingsTemplate;
class SettingsController {
static public function index() {
$latte = Wrappers::latte();
$latte->render(Misc::getView('settings'), new SettingsTemplate());
Wrappers::latte('settings', new SettingsTemplate());
}
static public function general() {

View file

@ -3,6 +3,7 @@ namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\UrlBuilder;
use App\Helpers\Wrappers;
use App\Models\FullTemplate;
use App\Models\RSSTemplate;
@ -15,8 +16,7 @@ class TagController {
$hashtag->feed($cursor);
if ($hashtag->ok()) {
$data = $hashtag->getFull();
$latte = Wrappers::latte();
$latte->render(Misc::getView('tag'), new FullTemplate($data->info->detail->title, $data));
Wrappers::latte('tag', new FullTemplate($data->info->detail->title, $data));
} else {
ErrorHandler::showMeta($hashtag->error());
}
@ -28,8 +28,8 @@ class TagController {
$hashtag->feed();
if ($hashtag->ok()) {
$data = $hashtag->getFull();
$latte = Wrappers::latte();
$latte->render(Misc::getView('rss'), new RSSTemplate($name, $data->info->detail->desc, "/tag/{$name}", $data->feed->items));
Misc::rss($name);
Wrappers::latte('rss', new RSSTemplate($name, $data->info->detail->desc, UrlBuilder::tag($name), $data->feed->items));
}
}
}

View file

@ -17,8 +17,7 @@ class TrendingController {
$feed = $trending->getFeed();
if ($feed && $feed->meta->success) {
$latte = Wrappers::latte();
$latte->render(Misc::getView('trending'), new FeedTemplate('Trending', $feed));
Wrappers::latte('trending', new FeedTemplate('Trending', $feed));
} else {
ErrorHandler::showMeta($trending->error());
}
@ -31,8 +30,8 @@ class TrendingController {
$feed = $trending->getFeed();
if ($feed && $feed->meta->success) {
$latte = Wrappers::latte();
$latte->render(Misc::getView('rss'), new RSSTemplate('Trending', 'Trending on TikTok', '/trending', $feed->items));
Misc::rss('Trending');
Wrappers::latte('rss', new RSSTemplate('Trending', 'Trending on TikTok', Misc::url('/trending'), $feed->items));
}
}
}

View file

@ -3,6 +3,7 @@ namespace App\Controllers;
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\UrlBuilder;
use App\Helpers\Wrappers;
use App\Models\FullTemplate;
use App\Models\RSSTemplate;
@ -20,8 +21,7 @@ class UserController {
ErrorHandler::showText(401, "Private account detected! Not supported");
return;
}
$latte = Wrappers::latte();
$latte->render(Misc::getView('user'), new FullTemplate($data->info->detail->nickname, $data));
Wrappers::latte('user', new FullTemplate($data->info->detail->nickname, $data));
} else {
ErrorHandler::showMeta($user->error());
}
@ -33,8 +33,7 @@ class UserController {
$video->feed();
if ($video->ok()) {
$data = $video->getFull();
$latte = Wrappers::latte();
$latte->render(Misc::getView('video'), new VideoTemplate($data->feed->items[0], $data->info->detail));
Wrappers::latte('video', new VideoTemplate($data->feed->items[0], $data->info->detail));
} else {
ErrorHandler::showMeta($video->error());
}
@ -46,8 +45,8 @@ class UserController {
$user->feed();
if ($user->ok()) {
$data = $user->getFull();
$latte = Wrappers::latte();
$latte->render(Misc::getView('rss'), new RSSTemplate($username, $data->info->detail->signature, '/@' . $username, $data->feed->items));
Misc::rss($username);
Wrappers::latte('rss', new RSSTemplate($username, $data->info->detail->signature, UrlBuilder::user($username), $data->feed->items));
}
}
}

View file

@ -7,13 +7,11 @@ use TikScraper\Models\Meta;
class ErrorHandler {
static public function showMeta(Meta $meta) {
http_response_code($meta->http_code);
$latte = Wrappers::latte();
$latte->render(Misc::getView('error'), new ErrorTemplate($meta->http_code, $meta->tiktok_msg, $meta->tiktok_code));
Wrappers::latte('error', new ErrorTemplate($meta->http_code, $meta->tiktok_msg, $meta->tiktok_code));
}
static public function showText(int $code, string $msg) {
http_response_code($code);
$latte = Wrappers::latte();
$latte->render(Misc::getView('error'), new ErrorTemplate($code, $msg));
Wrappers::latte('error', new ErrorTemplate($code, $msg));
}
}

View file

@ -24,4 +24,11 @@ class Misc {
static public function getView(string $template): string {
return __DIR__ . "/../../templates/views/{$template}.latte";
}
/**
* Common method for rss feeds
*/
static public function rss(string $title) {
header('Content-Disposition: attachment; filename="' . $title . '.rss' . '"');
}
}

View file

@ -7,7 +7,6 @@ class UrlBuilder {
}
static public function download(string $url, string $username, string $id, bool $watermark): string {
// {path('/download?url=' . urlencode($playAddr) . '&id=' . $id . '&user=' . $uniqueId) . '&watermark=1'}
$down_url = Misc::url('/download?url=' . urlencode($url) . '&id=' . $id . '&user=' . $username);
if ($watermark) $down_url .= '&watermark=1';
return $down_url;
@ -17,6 +16,10 @@ class UrlBuilder {
return Misc::url('/@' . $username);
}
static public function tag(string $tag): string {
return Misc::url('/tag/' . $tag);
}
static public function video_internal(string $username, string $id): string {
return Misc::url('/@' . $username . "/video/" . $id);
}

View file

@ -4,12 +4,13 @@ namespace App\Helpers;
use App\Cache\JSONCache;
use App\Cache\RedisCache;
use App\Constants\CacheMethods;
use App\Models\BaseTemplate;
class Wrappers {
/**
* Setup of Latte template engine
*/
static public function latte(): \Latte\Engine {
static public function latte(string $template, BaseTemplate $base) {
$latte = new \Latte\Engine;
$cache_path = Misc::env('LATTE_CACHE', __DIR__ . '/../../cache/latte');
$latte->setTempDirectory($cache_path);
@ -19,6 +20,32 @@ class Wrappers {
$latte->addFunction('path', function (string $endpoint = ''): string {
return Misc::url($endpoint);
});
// Static assets
$latte->addFunction('static', function (string $type, string $file, bool $isVendor = false): string {
$endpoint = '';
switch ($type) {
case 'js':
$endpoint .= '/scripts';
break;
case 'css':
$endpoint .= '/styles';
break;
default:
throw new \Exception('Invalid static asset type');
}
if ($isVendor) $endpoint .= '/vendor';
$endpoint .= '/' . $file;
return Misc::url($endpoint);
});
$latte->addFunction('theme', function(): string {
return Cookies::theme();
});
// Version being used
$latte->addFunction('version_frontend', function (): string {
return \Composer\InstalledVersions::getVersion('pablouser1/proxitok');
@ -26,8 +53,20 @@ class Wrappers {
$latte->addFunction('version_scraper', function (): string {
return \Composer\InstalledVersions::getVersion('pablouser1/tikscraper');
});
$latte->addFunction('theme', function(): string {
return Cookies::theme();
// https://stackoverflow.com/a/36365553
$latte->addFunction('number', function (float $x) {
if($x > 1000) {
$x_number_format = number_format($x);
$x_array = explode(',', $x_number_format);
$x_parts = array('K', 'M', 'B', 'T');
$x_count_parts = count($x_array) - 1;
$x_display = $x;
$x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : '');
$x_display .= $x_parts[$x_count_parts - 1];
return $x_display;
}
return $x;
});
// UrlBuilder
@ -46,21 +85,8 @@ class Wrappers {
$latte->addFunction('url_download', function (string $url, string $username, string $id, bool $watermark): string {
return UrlBuilder::download($url, $username, $id, $watermark);
});
// https://stackoverflow.com/a/36365553
$latte->addFunction('number', function (float $x) {
if($x > 1000) {
$x_number_format = number_format($x);
$x_array = explode(',', $x_number_format);
$x_parts = array('K', 'M', 'B', 'T');
$x_count_parts = count($x_array) - 1;
$x_display = $x;
$x_display = $x_array[0] . ((int) $x_array[1][0] !== 0 ? '.' . $x_array[1][0] : '');
$x_display .= $x_parts[$x_count_parts - 1];
return $x_display;
}
return $x;
});
return $latte;
$latte->render(Misc::getView($template), $base);
}
/**

View file

@ -6,7 +6,6 @@ namespace App\Models;
*/
class BaseTemplate {
public string $title;
public string $version;
function __construct(string $title) {
$this->title = $title;

View file

@ -1,14 +1,13 @@
<?php
namespace App\Models;
class RSSTemplate {
public string $title;
class RSSTemplate extends BaseTemplate {
public string $desc;
public string $link;
public array $items;
function __construct(string $title, string $desc, string $link, array $items) {
$this->title = $title;
parent::__construct($title);
$this->desc = $desc;
$this->link = $link;
$this->items = $items;

View file

@ -1,7 +1,7 @@
{
"name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok",
"version": "2.4.2.3",
"version": "2.4.3.0",
"license": "AGPL-3.0-or-later",
"type": "project",
"authors": [

28
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "0b40437551f24ae25f01113a85564867",
"content-hash": "7dc0bdf9fcecc4c3a73fb2fb1eece6f4",
"packages": [
{
"name": "bramus/router",
@ -117,22 +117,22 @@
},
{
"name": "latte/latte",
"version": "v2.11.5",
"version": "v2.11.6",
"source": {
"type": "git",
"url": "https://github.com/nette/latte.git",
"reference": "89e647e51213af8a270fe9903b8735a2f6c83ad1"
"reference": "af4dbb23a6044b1cf4904830a9b00246318c93d4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/latte/zipball/89e647e51213af8a270fe9903b8735a2f6c83ad1",
"reference": "89e647e51213af8a270fe9903b8735a2f6c83ad1",
"url": "https://api.github.com/repos/nette/latte/zipball/af4dbb23a6044b1cf4904830a9b00246318c93d4",
"reference": "af4dbb23a6044b1cf4904830a9b00246318c93d4",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-tokenizer": "*",
"php": ">=7.1 <8.2"
"php": ">=7.1 <8.3"
},
"conflict": {
"nette/application": "<2.4.1"
@ -195,9 +195,9 @@
],
"support": {
"issues": "https://github.com/nette/latte/issues",
"source": "https://github.com/nette/latte/tree/v2.11.5"
"source": "https://github.com/nette/latte/tree/v2.11.6"
},
"time": "2022-06-26T10:12:18+00:00"
"time": "2022-11-04T14:53:52+00:00"
},
{
"name": "m1/env",
@ -263,16 +263,16 @@
},
{
"name": "pablouser1/tikscraper",
"version": "v2.3.2.0",
"version": "v2.3.2.1",
"source": {
"type": "git",
"url": "https://github.com/pablouser1/TikScraperPHP.git",
"reference": "4b3c5952e1f9e126e2e1c80d006e70e759338c45"
"reference": "b67340e62cda1fb117b518e4f812e327aec094d6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/4b3c5952e1f9e126e2e1c80d006e70e759338c45",
"reference": "4b3c5952e1f9e126e2e1c80d006e70e759338c45",
"url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/b67340e62cda1fb117b518e4f812e327aec094d6",
"reference": "b67340e62cda1fb117b518e4f812e327aec094d6",
"shasum": ""
},
"require": {
@ -305,9 +305,9 @@
"description": "Get data from TikTok API",
"support": {
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.2.0"
"source": "https://github.com/pablouser1/TikScraperPHP/tree/v2.3.2.1"
},
"time": "2022-10-24T18:36:21+00:00"
"time": "2022-11-04T18:45:45+00:00"
},
{
"name": "php-webdriver/webdriver",

View file

@ -2,7 +2,6 @@
/** @var \Bramus\Router\Router $router */
use App\Helpers\ErrorHandler;
use App\Helpers\Misc;
use App\Helpers\Wrappers;
use App\Models\BaseTemplate;
@ -11,18 +10,15 @@ $router->set404(function () {
});
$router->get('/', function () {
$latte = Wrappers::latte();
$latte->render(Misc::getView('home'), new BaseTemplate('Home'));
Wrappers::latte('home', new BaseTemplate('Home'));
});
$router->get('/about', function () {
$latte = Wrappers::latte();
$latte->render(Misc::getView('about'), new BaseTemplate('About'));
Wrappers::latte('about', new BaseTemplate('About'));
});
$router->get('/verify', function () {
$latte = Wrappers::latte();
$latte->render(Misc::getView('verify'), new BaseTemplate('Verify'));
Wrappers::latte('verify', new BaseTemplate('verify'));
});
$router->get('/stream', 'ProxyController@stream');

View file

@ -16,5 +16,8 @@
@import "./node_modules/css.gg/icons/scss/share.scss";
@import "./node_modules/css.gg/icons/scss/software-download.scss";
@import "./node_modules/css.gg/icons/scss/lock.scss";
@import "./node_modules/css.gg/icons/scss/lock-unlock.scss";
// Video
@import "./node_modules/css.gg/icons/scss/music.scss";

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
{"version":3,"sourceRoot":"","sources":["../../scss/node_modules/css.gg/icons/scss/home.scss","../../scss/node_modules/css.gg/icons/scss/options.scss","../../scss/node_modules/css.gg/icons/scss/info.scss","../../scss/node_modules/css.gg/icons/scss/code-slash.scss","../../scss/node_modules/css.gg/icons/scss/search.scss","../../scss/node_modules/css.gg/icons/scss/feed.scss","../../scss/node_modules/css.gg/icons/scss/eye.scss","../../scss/node_modules/css.gg/icons/scss/heart.scss","../../scss/node_modules/css.gg/icons/scss/comment.scss","../../scss/node_modules/css.gg/icons/scss/share.scss","../../scss/node_modules/css.gg/icons/scss/software-download.scss","../../scss/node_modules/css.gg/icons/scss/music.scss"],"names":[],"mappings":"AAAA,SACE,yLACA,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,aACA,gBACA,4BACA,2BACA,6BACA,4BACA,mBAEA,gBACE,WACA,cACA,sBACA,kBAGF,iBACE,WACA,cACA,sBACA,kBACA,qBACA,sBACA,2BACA,wBACA,SACA,kBACA,WACA,YACA,OAGF,gBACE,UACA,YACA,iBACA,oBACA,4BACA,6BACA,gBACA,SACA,SCjDJ,YACI,sBACA,kBACA,cACA,+BACA,WACA,WACA,qCAEA,mBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,iBACA,mBAGF,oBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,iBACA,mBACA,SACA,UAGF,mBACE,YACA,WCnCN,SACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,mBAEA,iCACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,wBACA,SAGF,gBACE,WACA,WAGF,iBACE,WACA,QC5BN,eACI,cACA,kBACA,sBACA,6CACA,UACA,YACA,wBAEA,sBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,yBAGF,uBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,yBACA,sBACA,qBACA,UACA,QAGF,sBACE,uBACA,wBACA,WACA,QCrCN,WACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,mBACA,iBACA,gBAEA,kBACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,WACA,wBACA,yBACA,SACA,UCvBN,SACI,cACA,sBACA,wBACA,sBASA,iBACA,gBACA,kBACA,+BACA,UACA,WACA,kBAbA,iCACE,cACA,sBACA,wBACA,sBAWF,iCACE,WACA,kBACA,kBACA,WACA,WACA,QACA,SACA,WAGF,gBACE,UACA,QACA,WCnCN,QACI,kBACA,cACA,+BACA,WACA,YACA,iCACA,gCACA,gBACA,sBAEA,+BACE,WACA,cACA,oBACA,kBACA,sBAGF,eACE,QACA,8CACA,WACA,YAGF,gBACE,UACA,WACA,iBACA,WACA,SC/BN,UACI,iBACA,6BACA,8BACA,WACA,WACA,gBAeA,sBACA,kBACA,gHACA,cAhBA,iBACE,iBACA,6BACA,8BACA,WACA,WACA,gBACA,WACA,cACA,sBACA,kBAQF,kBACE,WACA,cACA,sBACA,kBAGF,iBACE,WACA,wBACA,QAGF,kBACE,WACA,YACA,sBACA,wBACA,UACA,QC7CN,YACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,gBACA,0CAEA,mBACE,WACA,cACA,sBACA,kBACA,UAGF,oBACE,WACA,cACA,sBACA,kBACA,UACA,iBACA,+BACA,+BACA,UACA,YACA,WAGF,mBACE,WACA,wBACA,qBACA,SACA,QCtCN,UACI,sBACA,kBACA,cACA,+BACA,UACA,WACA,wBACA,oBACA,kCAEA,iBACE,WACA,cACA,sBACA,kBACA,kBACA,WACA,WACA,wBACA,SAGF,kBACE,WACA,cACA,sBACA,kBACA,kBACA,WACA,WACA,wBACA,SACA,MACA,yBAGF,iBACE,SACA,wBCvCN,sBACI,sBACA,kBACA,cACA,+BACA,WACA,WACA,iBACA,aACA,8BACA,+BACA,eAEA,6BACE,WACA,cACA,sBACA,kBACA,UACA,WACA,sBACA,wBACA,yBACA,SACA,WAGF,8BACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,YACA,wBACA,SACA,WCrCN,UACI,cACA,sBACA,iBAQA,2BACA,4BACA,gBACA,gBACA,kBACA,6CACA,WACA,YAbA,mCACE,cACA,sBACA,iBAYF,mCACE,WACA,kBACA,UACA,WACA,QACA,UACA,uBACA,mBAGF,iBACE","file":"cssgg.min.css"}
{"version":3,"sourceRoot":"","sources":["../../scss/node_modules/css.gg/icons/scss/home.scss","../../scss/node_modules/css.gg/icons/scss/options.scss","../../scss/node_modules/css.gg/icons/scss/info.scss","../../scss/node_modules/css.gg/icons/scss/code-slash.scss","../../scss/node_modules/css.gg/icons/scss/search.scss","../../scss/node_modules/css.gg/icons/scss/feed.scss","../../scss/node_modules/css.gg/icons/scss/eye.scss","../../scss/node_modules/css.gg/icons/scss/heart.scss","../../scss/node_modules/css.gg/icons/scss/comment.scss","../../scss/node_modules/css.gg/icons/scss/share.scss","../../scss/node_modules/css.gg/icons/scss/software-download.scss","../../scss/node_modules/css.gg/icons/scss/lock.scss","../../scss/node_modules/css.gg/icons/scss/lock-unlock.scss","../../scss/node_modules/css.gg/icons/scss/music.scss"],"names":[],"mappings":"AAAA,SACE,yLACA,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,aACA,gBACA,4BACA,2BACA,6BACA,4BACA,mBAEA,gBACE,WACA,cACA,sBACA,kBAGF,iBACE,WACA,cACA,sBACA,kBACA,qBACA,sBACA,2BACA,wBACA,SACA,kBACA,WACA,YACA,OAGF,gBACE,UACA,YACA,iBACA,oBACA,4BACA,6BACA,gBACA,SACA,SCjDJ,YACI,sBACA,kBACA,cACA,+BACA,WACA,WACA,qCAEA,mBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,iBACA,mBAGF,oBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,iBACA,mBACA,SACA,UAGF,mBACE,YACA,WCnCN,SACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,mBAEA,iCACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,wBACA,SAGF,gBACE,WACA,WAGF,iBACE,WACA,QC5BN,eACI,cACA,kBACA,sBACA,6CACA,UACA,YACA,wBAEA,sBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,yBAGF,uBACE,WACA,cACA,sBACA,kBACA,UACA,WACA,yBACA,sBACA,qBACA,UACA,QAGF,sBACE,uBACA,wBACA,WACA,QCrCN,WACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,mBACA,iBACA,gBAEA,kBACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,WACA,wBACA,yBACA,SACA,UCvBN,SACI,cACA,sBACA,wBACA,sBASA,iBACA,gBACA,kBACA,+BACA,UACA,WACA,kBAbA,iCACE,cACA,sBACA,wBACA,sBAWF,iCACE,WACA,kBACA,kBACA,WACA,WACA,QACA,SACA,WAGF,gBACE,UACA,QACA,WCnCN,QACI,kBACA,cACA,+BACA,WACA,YACA,iCACA,gCACA,gBACA,sBAEA,+BACE,WACA,cACA,oBACA,kBACA,sBAGF,eACE,QACA,8CACA,WACA,YAGF,gBACE,UACA,WACA,iBACA,WACA,SC/BN,UACI,iBACA,6BACA,8BACA,WACA,WACA,gBAeA,sBACA,kBACA,gHACA,cAhBA,iBACE,iBACA,6BACA,8BACA,WACA,WACA,gBACA,WACA,cACA,sBACA,kBAQF,kBACE,WACA,cACA,sBACA,kBAGF,iBACE,WACA,wBACA,QAGF,kBACE,WACA,YACA,sBACA,wBACA,UACA,QC7CN,YACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,gBACA,0CAEA,mBACE,WACA,cACA,sBACA,kBACA,UAGF,oBACE,WACA,cACA,sBACA,kBACA,UACA,iBACA,+BACA,+BACA,UACA,YACA,WAGF,mBACE,WACA,wBACA,qBACA,SACA,QCtCN,UACI,sBACA,kBACA,cACA,+BACA,UACA,WACA,wBACA,oBACA,kCAEA,iBACE,WACA,cACA,sBACA,kBACA,kBACA,WACA,WACA,wBACA,SAGF,kBACE,WACA,cACA,sBACA,kBACA,kBACA,WACA,WACA,wBACA,SACA,MACA,yBAGF,iBACE,SACA,wBCvCN,sBACI,sBACA,kBACA,cACA,+BACA,WACA,WACA,iBACA,aACA,8BACA,+BACA,eAEA,6BACE,WACA,cACA,sBACA,kBACA,UACA,WACA,sBACA,wBACA,yBACA,SACA,WAGF,8BACE,WACA,cACA,sBACA,kBACA,kBACA,UACA,YACA,wBACA,SACA,WCrCN,SACI,sBACA,kBACA,cACA,+BACA,WACA,YACA,iBACA,4BACA,2BACA,4BACA,iBAEA,gBACE,WACA,cACA,sBACA,kBACA,WACA,YACA,kBACA,+BACA,qBACA,UACA,QCxBN,gBACI,sBACA,kBACA,cACA,+BACA,WACA,WACA,iBACA,8BACA,6BACA,4BACA,iBACA,iBAEA,+CACE,WACA,cACA,sBACA,kBAGF,uBACE,+BACA,qBACA,WACA,YACA,kBACA,UACA,SAGF,wBACE,UACA,WACA,wBACA,UACA,QCpCN,UACI,cACA,sBACA,iBAQA,2BACA,4BACA,gBACA,gBACA,kBACA,6CACA,WACA,YAbA,mCACE,cACA,sBACA,iBAYF,mCACE,WACA,kBACA,UACA,WACA,QACA,UACA,uBACA,mBAGF,iBACE","file":"cssgg.min.css"}

View file

@ -13,7 +13,7 @@
{if isset($has_rss)}
<link rel="alternate" type="application/rss+xml" title="{$title}" href="{$_SERVER['REQUEST_URI'] . '/rss'}" />
{/if}
<link rel="stylesheet" href="{path('/styles/vendor/cssgg.min.css')}">
<link rel="stylesheet" href="{path('/styles/vendor/bulma.min.css')}">
<link rel="stylesheet" href="{static('css', 'cssgg.min.css', true)}">
<link rel="stylesheet" href="{static('css', 'bulma.min.css', true)}">
<title>{$title} - ProxiTok</title>
</head>

View file

@ -26,4 +26,4 @@
</div>
</div>
</nav>
<script src="{path('/scripts/navbar.js')}"></script>
<script src="{static('js', 'navbar.js')}"></script>

View file

@ -1,18 +0,0 @@
{embed '../form.latte', path: '/settings/misc', method: 'POST', submit: true}
{block fields}
<div class="field">
<label class="label">Enable service worker</label>
<div class="control">
<label class="radio">
<input type="radio" name="misc-sw" value="yes" n:attr="checked => $isServiceWorker" />
<span>Yes</span>
</label>
<label class="radio">
<input type="radio" name="misc-sw" value="no" n:attr="checked => !$isServiceWorker" />
<span>No</span>
</label>
</div>
<p class="help">This can be used to install the PWA version of ProxiTok</p>
</div>
{/block}
{/embed}

View file

@ -1,4 +1,4 @@
<link rel="stylesheet" href="{path('/styles/themes/card.css')}">
<link rel="stylesheet" href="{static('css', 'themes/card.css')}">
<noscript>JavaScript is required for this section to work!</noscript>
<section class="section">
<div class="columns is-multiline is-vcentered">
@ -67,4 +67,4 @@
</footer>
</div>
</div>
<script src="{path('/scripts/themes/card.js')}"></script>
<script src="{static('js', 'themes/card.js')}"></script>

View file

@ -1,6 +1,6 @@
<div class="dropdown is-hoverable">
<div class="dropdown-trigger">
<button class="button" aria-haspopup="true" aria-controls="dropdown-menu">
<button class="button is-success" aria-haspopup="true" aria-controls="dropdown-menu">
{include '../../icon.latte', icon: 'software-download', text: 'Download'}
</button>
</div>

View file

@ -1,5 +1,17 @@
{do $endpoint = '/@' . $uniqueId . '/video/' . $id}
<div class="buttons is-centered">
<a class="button is-success is-small" href="{url_video_internal($uniqueId, $id)}">Instance Link</a>
<a class="button is-danger is-small" href="{url_video_external($uniqueId, $id)}">Original Link</a>
<div class="dropdown is-hoverable">
<div class="dropdown-trigger">
<button class="button is-primary" aria-haspopup="true" aria-controls="dropdown-menu">
{include '../../icon.latte', icon: 'share', text: 'Share'}
</button>
</div>
<div class="dropdown-menu" role="menu">
<div class="dropdown-content">
<a href="{url_video_internal($uniqueId, $id)}" class="dropdown-item has-text-success">
{include '../../icon.latte', icon: 'lock', text: 'Instance link'}
</a>
<a href="{url_video_external($uniqueId, $id)}" class="dropdown-item has-text-warning">
{include '../../icon.latte', icon: 'lock-unlock', text: 'Original Link'}
</a>
</div>
</div>
</div>

View file

@ -1,5 +1,5 @@
<div class="tags">
{foreach $challenges as $challenge}
<a class="tag is-rounded is-info" href="{path('/tag/' . $challenge->title)}">{$challenge->title}</a>
<a class="tag is-rounded" href="{path('/tag/' . $challenge->title)}">#{$challenge->title}</a>
{/foreach}
</div>

View file

@ -1,18 +1,16 @@
{contentType application/rss+xml}
{do header('Content-Disposition: attachment; filename="' . $title . '.rss' . '"')}
{var $full_link = path($link)}
<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{$title}</title>
<description><![CDATA[{$desc}]]></description>
<link>{$full_link}</link>
<atom:link href="{$full_link . '/rss'}" rel="self" type="application/rss+xml"></atom:link>
<link>{$link}</link>
<atom:link href="{$link . '/rss'}" rel="self" type="application/rss+xml"></atom:link>
{foreach $items as $item}
<item>
<title>{$item->desc}</title>
<description><![CDATA[<p>{$item->desc}</p><video controls="controls" preload="auto" src="{path('/stream?url=' . urlencode($item->video->playAddr))}"></video>]]></description>
<link>{path('/@' . $item->author->uniqueId . '/video/' . $item->id)}</link>
<description><![CDATA[<p>{$item->desc}</p><video controls="controls" preload="auto" src="{url_stream($item->video->playAddr)}"></video>]]></description>
<link>{url_video_internal($item->author->uniqueId, $item->id)}</link>
<pubDate>{date('r', $item->createTime)}</pubDate>
<guid isPermaLink="false">{$item->id}</guid>
</item>

View file

@ -5,7 +5,7 @@
{block header}
{if $data->info->detail->profileThumb !== ''}
<figure class="figure is-96x96">
<img src="{path('/stream?url=' . urlencode($data->info->detail->profileThumb))}" />
<img src="{url_stream($data->info->detail->profileThumb)}" />
</figure>
{/if}
<p class="title">{$data->info->detail->title}</p>

View file

@ -4,7 +4,7 @@
{block header}
<figure class="figure is-96x96">
<img src="{path('/stream?url=' . urlencode($data->info->detail->avatarThumb))}" />
<img src="{url_stream($data->info->detail->avatarThumb)}" />
</figure>
<p class="title">{$data->info->detail->uniqueId}</p>
<p class="subtitle">{include '../components/rss.latte'}</p>