Compare commits
3 commits
69c78510ff
...
338881b7ec
Author | SHA1 | Date | |
---|---|---|---|
flash | 338881b7ec | ||
flash | 82980eab8d | ||
flash | b09e8400d0 |
|
@ -7,13 +7,13 @@
|
|||
}
|
||||
|
||||
html,
|
||||
body,
|
||||
.wrapper {
|
||||
body {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.wrapper {
|
||||
min-height: 100%;
|
||||
font: 12px/20px Verdana, Geneva, 'Dejavu Sans', Arial, Helvetica, sans-serif;
|
||||
background: #111;
|
||||
color: #fff;
|
||||
|
@ -332,6 +332,31 @@ body,
|
|||
line-height: 14px;
|
||||
}
|
||||
|
||||
.info-files {
|
||||
background: #161616;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .6);
|
||||
text-shadow: 0 1px 4px #000;
|
||||
align-items: center;
|
||||
padding: 2px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
.info-files-header {
|
||||
font-size: 1.4em;
|
||||
padding: 5px 10px;
|
||||
}
|
||||
.info-files-content {
|
||||
padding: 5px 10px;
|
||||
overflow: auto;
|
||||
max-height: 300px;
|
||||
}
|
||||
.info-files-item {
|
||||
font-family: monospace;
|
||||
font-size: 1.1em;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
.profile {}
|
||||
|
||||
.profile-header {
|
||||
|
@ -751,3 +776,34 @@ body,
|
|||
font-size: 1.2em;
|
||||
padding: 4px 10px;
|
||||
}
|
||||
|
||||
.settings {}
|
||||
|
||||
.settings > div {
|
||||
background: #161616;
|
||||
overflow: hidden;
|
||||
width: 100%;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, .6);
|
||||
text-shadow: 0 1px 4px #000;
|
||||
align-items: center;
|
||||
padding: 2px;
|
||||
}
|
||||
.settings > div:not(:first-child) {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.settings > div > h2 {
|
||||
font-size: 1.4em;
|
||||
padding: 5px 10px 2px;
|
||||
}
|
||||
.settings > div > p {
|
||||
font-size: 0.9em;
|
||||
line-height: 1.5em;
|
||||
padding: 0 10px 5px;
|
||||
}
|
||||
.settings > div > form {
|
||||
padding: 5px 10px 10px;
|
||||
overflow: auto;
|
||||
}
|
||||
.settings > div > form > button {
|
||||
padding: 5px 10px;
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ final class SeriaContext {
|
|||
|
||||
$routing->register(new HomeRoutes($this->templating));
|
||||
$routing->register(new Users\ProfileRoutes($this->authInfo, $this->torrentsCtx, $this->usersCtx, $this->templating));
|
||||
$routing->register(new Users\SettingsRoutes($this->authInfo, $this->templating));
|
||||
$routing->register(new Users\SettingsRoutes($this->authInfo, $this->usersCtx, $this->csrfp, $this->templating));
|
||||
$routing->register(new Torrents\AnnounceRouting($this->torrentsCtx, $this->usersCtx));
|
||||
$routing->register(new Torrents\TorrentCreateRouting($this->dbConn, $this->authInfo, $this->torrentsCtx, $this->csrfp, $this->templating));
|
||||
$routing->register(new Torrents\TorrentInfoRouting($this->authInfo, $this->torrentsCtx, $this->usersCtx, $this->csrfp, $this->templating));
|
||||
|
|
|
@ -88,7 +88,9 @@ class TorrentInfoRouting extends RouteHandler {
|
|||
$completePeers = $peers->countCompletePeers($this->torrentInfo);
|
||||
$incompletePeers = $peers->countIncompletePeers($this->torrentInfo);
|
||||
|
||||
$totalFileSize = $this->torrentsCtx->getFiles()->countTotalSize($this->torrentInfo);
|
||||
$files = $this->torrentsCtx->getFiles();
|
||||
$totalFileSize = $files->countTotalSize($this->torrentInfo);
|
||||
$fileList = $files->getFiles($this->torrentInfo);
|
||||
|
||||
return $this->templating->render('info', [
|
||||
'torrent_info' => $this->torrentInfo,
|
||||
|
@ -96,6 +98,7 @@ class TorrentInfoRouting extends RouteHandler {
|
|||
'torrent_total_size' => $totalFileSize,
|
||||
'torrent_complete_peers' => $completePeers,
|
||||
'torrent_incomplete_peers' => $incompletePeers,
|
||||
'torrent_files' => $fileList,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,23 +3,45 @@ namespace Seria\Users;
|
|||
|
||||
use Index\Routing\Route;
|
||||
use Index\Routing\RouteHandler;
|
||||
use Index\Security\CSRFP;
|
||||
use Sasae\SasaeEnvironment;
|
||||
use Seria\Auth\AuthInfo;
|
||||
use Seria\Users\UsersContext;
|
||||
|
||||
class SettingsRoutes extends RouteHandler {
|
||||
public function __construct(
|
||||
private AuthInfo $authInfo,
|
||||
private UsersContext $usersCtx,
|
||||
private CSRFP $csrfp,
|
||||
private ?SasaeEnvironment $templating
|
||||
) {}
|
||||
|
||||
#[Route('GET', '/settings')]
|
||||
public function getIndex($response) {
|
||||
#[Route('/settings')]
|
||||
public function checkLogin($response, $request) {
|
||||
if(!$this->authInfo->isLoggedIn())
|
||||
return 403;
|
||||
|
||||
if($request->getMethod() === 'POST') {
|
||||
if(!$request->isFormContent())
|
||||
return 400;
|
||||
|
||||
$content = $request->getContent();
|
||||
if(!$this->csrfp->verifyToken((string)$content->getParam('_csrfp')))
|
||||
return 403;
|
||||
}
|
||||
}
|
||||
|
||||
#[Route('GET', '/settings')]
|
||||
public function getIndex($response) {
|
||||
return $this->templating->render('settings');
|
||||
}
|
||||
|
||||
#[Route('POST', '/settings/passkey')]
|
||||
public function postPasskey($response) {
|
||||
$this->usersCtx->getUsers()->updatePassKey($this->authInfo->getUserInfo());
|
||||
$response->redirect('/settings');
|
||||
}
|
||||
|
||||
#[Route('GET', '/settings.php')]
|
||||
public function getSettingsPHP($response): void {
|
||||
$response->redirect('/settings', true);
|
||||
|
|
|
@ -79,9 +79,7 @@ readonly class UserInfo {
|
|||
}
|
||||
|
||||
public function canCreateTorrents(): bool {
|
||||
return $this->isFlash()
|
||||
|| $this->id === '32'
|
||||
|| $this->id === '145';
|
||||
return true;
|
||||
}
|
||||
|
||||
public function canApproveTorrents(): bool {
|
||||
|
|
|
@ -72,6 +72,15 @@
|
|||
<div class="info-comment-content"><pre>{{ torrent_info.comment }}</pre></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="info-files">
|
||||
<div class="info-files-header">Files</div>
|
||||
<div class="info-files-content">
|
||||
{% for file in torrent_files %}
|
||||
<div class="info-files-item">{{ file.path }} ({{ file.length|format_filesize }})</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
(function() {
|
||||
|
|
|
@ -3,5 +3,14 @@
|
|||
{% set title = 'Settings' %}
|
||||
|
||||
{% block content %}
|
||||
Provide option to reset pass key and shit here, maybe also a nuke tracker profile option but probably not.
|
||||
<div class="settings">
|
||||
<div class="settings-reset">
|
||||
<h2>Reset Passkey</h2>
|
||||
<p>In case you accidentally exposed your passkey to other people. This button will generate a new passkey for you, but that also means any existing torrent you may be seeding or downloading will no longer work and you'll have to redownload the .torrent file.</p>
|
||||
<form action="/settings/passkey" method="post">
|
||||
<input type="hidden" name="_csrfp" value="{{ csrfp_token() }}">
|
||||
<button>Generate a new passkey</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue