Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
fix(fix): Fix torrent can't upload after last commits
Browse files Browse the repository at this point in the history
1. mv 'src\private' to 'private' , 'src\runtime' to 'var'
2. Remove Site->ruleCanUsedTeam() function
3. Fix namespace error of App\Models\Api\v1\Form\TorrentsForm
4. Fix logo image lost..
  • Loading branch information
Rhilip committed Sep 11, 2019
1 parent 8075d58 commit 69fdce9
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://github.com/Rhilip/RidPT/raw/master/apps/public/static/pic/logo.png" width='256px'><br/>
<img src="https://github.com/Rhilip/RidPT/raw/master/public/static/pic/logo.png" width='256px'><br/>
A Private Torrent framework Project.<br/>
<a href="https://github.com/Rhilip/RidPT/releases"><img src="https://img.shields.io/github/release/Rhilip/RidPT.svg" alt="GitHub Releases" /></a>
<a href="https://www.swoole.com/"><img src="https://img.shields.io/badge/used-Swoole-blue.svg" alt="used-Swoole-blue" /></a>
Expand Down
2 changes: 1 addition & 1 deletion bin/rid-httpd
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ $dotenv->load(); // $dotenv->overload();

/*
* --------------------------------------------------------------------------
* FIXME Start Console Application
* Start Console Application
* --------------------------------------------------------------------------
*/
$config = require RIDPT_ROOT . '/config/httpd.php';
Expand Down
9 changes: 5 additions & 4 deletions framework/Http/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Rid\Http;

use Rid\Base\Component;
use Swoole\Http\Server;

/**
* App类
Expand Down Expand Up @@ -191,22 +192,22 @@ public function end($content = '')
}

/**
* @return \Swoole\Http\Server
* @return Server
*/
public function getServ()
{
return $this->_serv;
}

/**
* @param \Swoole\Http\Server $serv
* @param Server $serv
*/
public function setServ(\Swoole\Http\Server $serv): void
public function setServ(Server $serv): void
{
$this->_serv = $serv;
}

public function getWorkerId():int
public function getWorkerId(): int
{
return $this->_worker ?? -1;
}
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions src/Components/Site.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,6 @@ public function ruleTeam(): array
return $data ?: [];
}

public function ruleCanUsedTeam(): array
{
return array_filter($this->ruleTeam(), function ($team) {
return app()->auth->getCurUser()->getClass() >= $team['class_require'];
});
}

/**
* @return array like [<tag1> => <tag1_class_name>, <tag2> => <tag2_class_name>]
*/
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/Api/v1/TorrentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace App\Controllers\Api\v1;

use App\Models\api\v1\Form\TorrentsForm;
use App\Models\Api\v1\Form\TorrentsForm;

class TorrentController extends ApiController
{
Expand Down
22 changes: 11 additions & 11 deletions src/Models/Form/Torrents/UploadForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ public static function inputRules(): array

// Add Quality Valid
foreach (app()->site->getQualityTableList() as $quality => $title) {
$quality_id_list = [];
$quality_id_list = [0];
// IF enabled this quality field , then load it value list from setting
// Else we just allow the default value 0 to prevent cheating
if (config('torrent_upload.enable_quality_' . $quality)) {
$quality_id_list = array_map(function ($cat) {
return $cat['id'];
}, app()->site->ruleQuality($quality));
foreach (app()->site->ruleQuality($quality) as $cat) {
$quality_id_list[] = $cat['id'];
}
}

$rules[$quality] = [
Expand All @@ -129,11 +129,13 @@ public static function inputRules(): array
}

// Add Team id Valid
$team_id_list = [];
$team_id_list = [0];
if (config('torrent_upload.enable_teams')) {
$team_id_list = array_map(function ($team) {
return $team['id'];
}, app()->site->ruleCanUsedTeam());
foreach (app()->site->ruleTeam() as $team) {
if (app()->auth->getCurUser()->getClass() >= $team['class_require']) {
$team_id_list[] = $team['id'];
}
}
}

$rules['team'] = [
Expand Down Expand Up @@ -373,9 +375,7 @@ private function getTags(): array
$tags_list = array_slice($tags_list, 0, 10); // Get first 10 tags

if (!config('torrent_upload.allow_new_custom_tags')) {
$rule_pinned_tags = array_map(function ($tag_row) {
return $tag_row['tag'];
}, app()->site->rulePinnedTags());
$rule_pinned_tags = array_keys(app()->site->rulePinnedTags());
$tags_list = array_intersect($rule_pinned_tags, $tags_list);
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/torrent/details.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<span class="red"><i class="fas fa-arrow-down fa-fw"></i> <?= $torrent->getIncomplete() ?></span> /
<span><i class="fas fa-check fa-fw"></i> <?= $torrent->getDownloaded() ?></span>
</div>
<div data-field="info_hash"><b>Info Hash:</b><kbd><?= $torrent->getInfoHash() ?></kbd></div>
<div data-field="info_hash" class="nowrap"><b>Info Hash:</b><kbd><?= $torrent->getInfoHash() ?></kbd></div>
</div>
</div>
<div class="panel" id="torrent_action_panel">
Expand Down
6 changes: 4 additions & 2 deletions templates/torrents/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@
<span class="input-group-addon"><label for="team">Group</label></span>
<select id="team" name="team" class="form-control">
<option value="0" selected>[Choose One]</option>
<?php foreach (app()->site->ruleCanUsedTeam() as $team) : ?>
<option value="<?= $team['id'] ?>"><?= $team['name'] ?></option>
<?php foreach (app()->site->ruleTeam() as $team) : ?>
<?php if (app()->auth->getCurUser()->getClass() >= $team['class_require']): ?>
<option value="<?= $team['id'] ?>"><?= $team['name'] ?></option>
<?php endif ?>
<?php endforeach; ?>
</select>
</div>
Expand Down
File renamed without changes.

0 comments on commit 69fdce9

Please sign in to comment.