diff --git a/README.md b/README.md
index 1ec1601..9342f2b 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ Apply to: Main window (address bar)
## TODO / Known issues
* Make video on /video fit screen and don't overflow
-* Search
+* Fix embed styling
## Credits
[@TheFrenchGhosty](https://github.com/TheFrenchGhosty): Initial Dockerfile and fixes to a usable state. You can check his Docker image [here](https://github.com/PussTheCat-org/docker-proxitok-quay) on Github or [here](https://quay.io/repository/pussthecatorg/proxitok) on Quay
diff --git a/app/Controllers/EmbedController.php b/app/Controllers/EmbedController.php
new file mode 100644
index 0000000..7e78741
--- /dev/null
+++ b/app/Controllers/EmbedController.php
@@ -0,0 +1,20 @@
+getVideoByID($id);
+ if ($feed->meta->success) {
+ $latte = Wrappers::latte();
+ $latte->render(Misc::getView('video'), new VideoTemplate($feed->items[0], $feed->info->detail, true));
+ } else {
+ ErrorHandler::show($feed->meta);
+ }
+ }
+}
diff --git a/app/Controllers/UserController.php b/app/Controllers/UserController.php
index f1b52d8..8fe8d07 100644
--- a/app/Controllers/UserController.php
+++ b/app/Controllers/UserController.php
@@ -6,6 +6,7 @@ use App\Helpers\Misc;
use App\Helpers\Wrappers;
use App\Models\FeedTemplate;
use App\Models\RSSTemplate;
+use App\Models\VideoTemplate;
class UserController {
static public function get(string $username) {
@@ -30,7 +31,7 @@ class UserController {
$feed = $api->getVideoByID($video_id);
if ($feed->meta->success) {
$latte = Wrappers::latte();
- $latte->render(Misc::getView('video'), new FeedTemplate('Video', $feed));
+ $latte->render(Misc::getView('video'), new VideoTemplate($feed->items[0], $feed->info->detail));
} else {
ErrorHandler::show($feed->meta);
}
diff --git a/app/Models/VideoTemplate.php b/app/Models/VideoTemplate.php
new file mode 100644
index 0000000..eb09545
--- /dev/null
+++ b/app/Models/VideoTemplate.php
@@ -0,0 +1,22 @@
+item = $item;
+ $this->detail = $detail;
+ if ($isEmbed) {
+ $this->layout = 'embed';
+ } else {
+ $this->layout = 'hero';
+ }
+ }
+}
diff --git a/components/footer.latte b/components/footer.latte
deleted file mode 100644
index cc6a0b9..0000000
--- a/components/footer.latte
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/composer.json b/composer.json
index 64d74f7..87e4b05 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"name": "pablouser1/proxitok",
"description": "An alternative frontend for TikTok",
- "version": "2.2.0.0",
+ "version": "2.2.1.0",
"license": "AGPL-3.0-or-later",
"type": "project",
"homepage": "https://github.com/pablouser1/ProxiTok",
diff --git a/composer.lock b/composer.lock
index cab03a5..187e2cf 100644
--- a/composer.lock
+++ b/composer.lock
@@ -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": "def7d3d4bbdae6916d99e50b33b3595a",
+ "content-hash": "417e49088860de4bd40099b5cef1e215",
"packages": [
{
"name": "bramus/router",
@@ -121,16 +121,16 @@
},
{
"name": "latte/latte",
- "version": "v2.11.0",
+ "version": "v2.11.1",
"source": {
"type": "git",
"url": "https://github.com/nette/latte.git",
- "reference": "a815687bfadaf3af51ae99f92edb4ea310c43426"
+ "reference": "21316b42fb0a4e43df01f73c55d52bd531823fda"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/nette/latte/zipball/a815687bfadaf3af51ae99f92edb4ea310c43426",
- "reference": "a815687bfadaf3af51ae99f92edb4ea310c43426",
+ "url": "https://api.github.com/repos/nette/latte/zipball/21316b42fb0a4e43df01f73c55d52bd531823fda",
+ "reference": "21316b42fb0a4e43df01f73c55d52bd531823fda",
"shasum": ""
},
"require": {
@@ -199,22 +199,22 @@
],
"support": {
"issues": "https://github.com/nette/latte/issues",
- "source": "https://github.com/nette/latte/tree/v2.11.0"
+ "source": "https://github.com/nette/latte/tree/v2.11.1"
},
- "time": "2022-02-22T18:39:58+00:00"
+ "time": "2022-04-07T13:21:53+00:00"
},
{
"name": "pablouser1/tikscraper",
- "version": "v1.3.2.0",
+ "version": "v1.3.3.0",
"source": {
"type": "git",
"url": "https://github.com/pablouser1/TikScraperPHP.git",
- "reference": "8aa4524d3f11c4087dcae565a874b9440b1468c7"
+ "reference": "412bbbe5415e13207fe24b8e8274c527c82f01d6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/8aa4524d3f11c4087dcae565a874b9440b1468c7",
- "reference": "8aa4524d3f11c4087dcae565a874b9440b1468c7",
+ "url": "https://api.github.com/repos/pablouser1/TikScraperPHP/zipball/412bbbe5415e13207fe24b8e8274c527c82f01d6",
+ "reference": "412bbbe5415e13207fe24b8e8274c527c82f01d6",
"shasum": ""
},
"require": {
@@ -240,9 +240,9 @@
"description": "Get data from TikTok API",
"support": {
"issues": "https://github.com/pablouser1/TikScraperPHP/issues",
- "source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.3.2.0"
+ "source": "https://github.com/pablouser1/TikScraperPHP/tree/v1.3.3.0"
},
- "time": "2022-03-29T17:10:36+00:00"
+ "time": "2022-04-10T10:08:40+00:00"
},
{
"name": "php-webdriver/webdriver",
@@ -660,16 +660,16 @@
},
{
"name": "symfony/process",
- "version": "v6.0.5",
+ "version": "v6.0.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "1ccceccc6497e96f4f646218f04b97ae7d9fa7a1"
+ "reference": "e13f6757e267d687e20ec5b26ccfcbbe511cd8f4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/1ccceccc6497e96f4f646218f04b97ae7d9fa7a1",
- "reference": "1ccceccc6497e96f4f646218f04b97ae7d9fa7a1",
+ "url": "https://api.github.com/repos/symfony/process/zipball/e13f6757e267d687e20ec5b26ccfcbbe511cd8f4",
+ "reference": "e13f6757e267d687e20ec5b26ccfcbbe511cd8f4",
"shasum": ""
},
"require": {
@@ -701,7 +701,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/process/tree/v6.0.5"
+ "source": "https://github.com/symfony/process/tree/v6.0.7"
},
"funding": [
{
@@ -717,7 +717,7 @@
"type": "tidelift"
}
],
- "time": "2022-01-30T18:19:12+00:00"
+ "time": "2022-03-18T16:21:55+00:00"
},
{
"name": "vlucas/phpdotenv",
@@ -811,5 +811,5 @@
"ext-mbstring": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.2.0"
+ "plugin-api-version": "2.3.0"
}
diff --git a/embed.js b/embed.js
new file mode 100644
index 0000000..530ba8e
--- /dev/null
+++ b/embed.js
@@ -0,0 +1,15 @@
+// Workaround to allow TikTok embed
+
+const blockquotes = document.getElementsByClassName('tiktok-embed')
+for (let i = 0; i < blockquotes.length; i++) {
+ const blockquote = blockquotes[i]
+ if (blockquote.children.length > 0 && blockquote.children[0].tagName !== 'iframe') {
+ const iframe = document.createElement('iframe')
+ iframe.style = 'width: 100%; height: 710px; display: block; visibility: unset; max-height: 710px;'
+ iframe.src = 'https://www.tiktok.com/embed/v2/' + blockquote.dataset.videoId // This url will get redirected
+ // Remove placeholder section
+ blockquote.children[0].remove()
+ // Add iframe
+ blockquote.appendChild(iframe)
+ }
+}
diff --git a/layouts/default.latte b/layouts/default.latte
index 42dff56..a3d58d9 100644
--- a/layouts/default.latte
+++ b/layouts/default.latte
@@ -15,7 +15,6 @@
- {include '../components/footer.latte'}
{block extra}{/block}