skip offer + pt-gen fill subtitle

This commit is contained in:
xiaomlove
2022-09-04 15:56:19 +08:00
parent 7613a05951
commit 589332afb3
22 changed files with 80 additions and 11 deletions
+15 -3
View File
@@ -61,15 +61,14 @@ class TagResource extends Resource
Tables\Columns\TextColumn::make('padding')->label(__('label.tag.padding')), Tables\Columns\TextColumn::make('padding')->label(__('label.tag.padding')),
Tables\Columns\TextColumn::make('border_radius')->label(__('label.tag.border_radius')), Tables\Columns\TextColumn::make('border_radius')->label(__('label.tag.border_radius')),
Tables\Columns\TextColumn::make('priority')->label(__('label.priority'))->sortable(), Tables\Columns\TextColumn::make('priority')->label(__('label.priority'))->sortable(),
Tables\Columns\TextColumn::make('torrents_count')->label(__('label.tag.torrents_count')),
Tables\Columns\TextColumn::make('updated_at')->dateTime()->label(__('label.updated_at')), Tables\Columns\TextColumn::make('updated_at')->dateTime()->label(__('label.updated_at')),
]) ])
->defaultSort('priority', 'desc') ->defaultSort('priority', 'desc')
->filters([ ->filters([
// //
]) ])
->actions([ ->actions(self::getActions())
Tables\Actions\EditAction::make(),
])
->bulkActions([ ->bulkActions([
Tables\Actions\DeleteBulkAction::make(), Tables\Actions\DeleteBulkAction::make(),
]); ]);
@@ -90,4 +89,17 @@ class TagResource extends Resource
'edit' => Pages\EditTag::route('/{record}/edit'), 'edit' => Pages\EditTag::route('/{record}/edit'),
]; ];
} }
private static function getActions(): array
{
$actions = [];
$actions[] = Tables\Actions\Action::make('detach_torrents')
->label(__('admin.resources.tag.detach_torrents'))
->requiresConfirmation()
->action(function ($record) {
$record->torrent_tags()->delete();
});
$actions[] = Tables\Actions\EditAction::make();
return $actions;
}
} }
@@ -4,8 +4,10 @@ namespace App\Filament\Resources\Torrent\TagResource\Pages;
use App\Filament\PageList; use App\Filament\PageList;
use App\Filament\Resources\Torrent\TagResource; use App\Filament\Resources\Torrent\TagResource;
use App\Models\Tag;
use Filament\Pages\Actions; use Filament\Pages\Actions;
use Filament\Resources\Pages\ListRecords; use Filament\Resources\Pages\ListRecords;
use Illuminate\Database\Eloquent\Builder;
class ListTags extends PageList class ListTags extends PageList
{ {
@@ -17,4 +19,11 @@ class ListTags extends PageList
Actions\CreateAction::make(), Actions\CreateAction::make(),
]; ];
} }
protected function getTableQuery(): Builder
{
return Tag::query()->withCount('torrents');
}
} }
+5
View File
@@ -53,6 +53,11 @@ class Tag extends NexusModel
return $this->belongsToMany(Torrent::class, 'torrent_tags', 'tag_id', 'torrent_id'); return $this->belongsToMany(Torrent::class, 'torrent_tags', 'tag_id', 'torrent_id');
} }
public function torrent_tags(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(TorrentTag::class, 'tag_id');
}
} }
+1 -1
View File
@@ -1,6 +1,6 @@
<?php <?php
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.24'); defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.24');
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-03'); defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-09-04');
defined('IN_TRACKER') || define('IN_TRACKER', false); defined('IN_TRACKER') || define('IN_TRACKER', false);
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP"); defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org"); defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
+1
View File
@@ -137,6 +137,7 @@ $lang_offers = array
'text_rule_three_two' => "小时后未被通过,它将被删除。", 'text_rule_three_two' => "小时后未被通过,它将被删除。",
'text_rule_four_one' => "如在候选通过后", 'text_rule_four_one' => "如在候选通过后",
'text_rule_four_two' => "小时内用户没有发布种子,通过的候选将被删除。", 'text_rule_four_two' => "小时内用户没有发布种子,通过的候选将被删除。",
'text_rule_skip_offer' => "当用户通过的候选数大于等于<b>%d</b>时,可直接发布种子,无需经过候选。",
); );
?> ?>
+2
View File
@@ -769,6 +769,8 @@ $lang_settings = array
'row_harem_addition' => '后宫加成', 'row_harem_addition' => '后宫加成',
'text_user_would_get_by_harem' => '用户将获得直属后宫魔力值的', 'text_user_would_get_by_harem' => '用户将获得直属后宫魔力值的',
'text_harem_addition_note' => '倍作为奖励(系数,如填入 0.01,后宫获得 100 魔力则奖励用户 100 * 0.01 = 1', 'text_harem_addition_note' => '倍作为奖励(系数,如填入 0.01,后宫获得 100 魔力则奖励用户 100 * 0.01 = 1',
'row_offer_skip_approved_count' => '直接发布候选通过数',
'text_offer_skip_approved_count_note' => '当通过的候选数大于等于此数值时,可直接发布不用提交候选。',
); );
?> ?>
+1
View File
@@ -137,6 +137,7 @@ $lang_offers = array
'text_rule_three_two' => "小時后未被通過,它將被移除。", 'text_rule_three_two' => "小時后未被通過,它將被移除。",
'text_rule_four_one' => "如在候選通過后", 'text_rule_four_one' => "如在候選通過后",
'text_rule_four_two' => "小時內用戶沒有發布種子,通過的候選將被移除。", 'text_rule_four_two' => "小時內用戶沒有發布種子,通過的候選將被移除。",
'text_rule_skip_offer' => "當用戶通過的候選數大於等於<b>%d</b>時,可直接發布種子,無需經過候選。",
); );
?> ?>
+2
View File
@@ -769,6 +769,8 @@ $lang_settings = array
'row_harem_addition' => '後宮加成', 'row_harem_addition' => '後宮加成',
'text_user_would_get_by_harem' => '用戶將獲得直屬後宮魔力值的', 'text_user_would_get_by_harem' => '用戶將獲得直屬後宮魔力值的',
'text_harem_addition_note' => '倍作為獎勵(系數,如填入 0.01,後宮獲得 100 魔力則獎勵用戶 100 * 0.01 = 1', 'text_harem_addition_note' => '倍作為獎勵(系數,如填入 0.01,後宮獲得 100 魔力則獎勵用戶 100 * 0.01 = 1',
'row_offer_skip_approved_count' => '直接發布候選通過數',
'text_offer_skip_approved_count_note' => '當通過的候選數大於等於此數值時,可直接發布不用提交候選。',
); );
?> ?>
+1
View File
@@ -137,6 +137,7 @@ $lang_offers = array
'text_rule_three_two' => " hours after added.", 'text_rule_three_two' => " hours after added.",
'text_rule_four_one' => "Offers will be deleted if not uploaded ", 'text_rule_four_one' => "Offers will be deleted if not uploaded ",
'text_rule_four_two' => " hours after being approved.", 'text_rule_four_two' => " hours after being approved.",
'text_rule_skip_offer' => "When the number of offers passed by the user is greater than or equal to <b>%d</b>, user can upload torrents directly without going through offers section.",
); );
?> ?>
+2
View File
@@ -769,6 +769,8 @@ $lang_settings = array
'row_harem_addition' => 'Harem addition', 'row_harem_addition' => 'Harem addition',
'text_user_would_get_by_harem' => 'The user will receive the bonus value of the direct harem', 'text_user_would_get_by_harem' => 'The user will receive the bonus value of the direct harem',
'text_harem_addition_note' => 'times as reward (factor, e.g. fill in 0.01, if harem gets 100 bonus then reward user 100 * 0.01 = 1)', 'text_harem_addition_note' => 'times as reward (factor, e.g. fill in 0.01, if harem gets 100 bonus then reward user 100 * 0.01 = 1)',
'row_offer_skip_approved_count' => 'Direct upload offer allow count',
'text_offer_skip_approved_count_note' => 'When the number of approved offer is greater than or equal to this value, you can upload directly without submitting offers.',
); );
?> ?>
+1
View File
@@ -91,6 +91,7 @@ return array (
'site_language_enabled' => \App\Models\Language::DEFAULT_ENABLED, 'site_language_enabled' => \App\Models\Language::DEFAULT_ENABLED,
'show_top_uploader' => 'no', 'show_top_uploader' => 'no',
'imdb_language' => 'en-US', 'imdb_language' => 'en-US',
'offer_skip_approved_count' => 5,
), ),
'smtp' => 'smtp' =>
array ( array (
+2 -2
View File
@@ -39,9 +39,9 @@ function getPtGen($params)
$rep = new Nexus\PTGen\PTGen(); $rep = new Nexus\PTGen\PTGen();
$result = $rep->generate($params['url']); $result = $rep->generate($params['url']);
if ($rep->isRawPTGen($result)) { if ($rep->isRawPTGen($result)) {
return $result['format']; return $result;
} elseif ($rep->isIyuu($result)) { } elseif ($rep->isIyuu($result)) {
return $result['data']['format']; return $result['data'];
} else { } else {
return ''; return '';
} }
+8 -1
View File
@@ -1,5 +1,6 @@
jQuery('.btn-get-pt-gen').on('click', function () { jQuery('.btn-get-pt-gen').on('click', function () {
let input = jQuery(this).closest('td').find('[data-pt-gen]') let input = jQuery(this).closest('td').find('[data-pt-gen]')
let form = jQuery(this).closest('form')
let value = input.val().trim() let value = input.val().trim()
if (value == '') { if (value == '') {
return return
@@ -17,6 +18,12 @@ jQuery('.btn-get-pt-gen').on('click', function () {
alert(response.msg) alert(response.msg)
return return
} }
doInsert(response.data, '', false) doInsert(response.data.format, '', false)
if (response.data.aka) {
form.find("input[name=small_descr]").val(response.data.aka.join("/"))
}
if (response.data.imdb_link) {
form.find("input[name=url]").val(response.data.imdb_link)
}
}, 'json') }, 'json')
}) })
+4
View File
@@ -699,6 +699,10 @@ begin_frame($lang_offers['text_offers_section'], true,10,"100%","center");
print("<p align=\"left\"><b><font size=\"5\">".$lang_offers['text_rules']."</font></b></p>\n"); print("<p align=\"left\"><b><font size=\"5\">".$lang_offers['text_rules']."</font></b></p>\n");
print("<div align=\"left\"><ul>"); print("<div align=\"left\"><ul>");
print("<li>".$lang_offers['text_rule_one_one'].get_user_class_name($upload_class, false, true, true).$lang_offers['text_rule_one_two'].get_user_class_name($addoffer_class, false, true, true).$lang_offers['text_rule_one_three']."</li>\n"); print("<li>".$lang_offers['text_rule_one_one'].get_user_class_name($upload_class, false, true, true).$lang_offers['text_rule_one_two'].get_user_class_name($addoffer_class, false, true, true).$lang_offers['text_rule_one_three']."</li>\n");
$offerSkipApprovedCount = get_setting('main.offer_skip_approved_count');
if (is_numeric($offerSkipApprovedCount) && $offerSkipApprovedCount > 0) {
print("<li>".sprintf($lang_offers['text_rule_skip_offer'], $offerSkipApprovedCount)."</li>\n");
}
print("<li>".$lang_offers['text_rule_two_one']."<b>".$minoffervotes."</b>".$lang_offers['text_rule_two_two']."</li>\n"); print("<li>".$lang_offers['text_rule_two_one']."<b>".$minoffervotes."</b>".$lang_offers['text_rule_two_two']."</li>\n");
if ($offervotetimeout_main) if ($offervotetimeout_main)
print("<li>".$lang_offers['text_rule_three_one']."<b>".($offervotetimeout_main / 3600)."</b>".$lang_offers['text_rule_three_two']."</li>\n"); print("<li>".$lang_offers['text_rule_three_one']."<b>".($offervotetimeout_main / 3600)."</b>".$lang_offers['text_rule_three_two']."</li>\n");
+3 -1
View File
@@ -42,7 +42,7 @@ if ($action == 'savesettings_main') // save main
'showpolls','showstats','showlastxtorrents', 'showtrackerload','showshoutbox','showfunbox','showoffer','sptime','showhelpbox','enablebitbucket', 'showpolls','showstats','showlastxtorrents', 'showtrackerload','showshoutbox','showfunbox','showoffer','sptime','showhelpbox','enablebitbucket',
'smalldescription','altname','extforum','extforumurl','defaultlang','defstylesheet', 'donation','spsct','browsecat','specialcat','waitsystem', 'smalldescription','altname','extforum','extforumurl','defaultlang','defstylesheet', 'donation','spsct','browsecat','specialcat','waitsystem',
'maxdlsystem','bitbucket','torrentnameprefix', 'showforumstats','verification','invite_count','invite_timeout', 'seeding_leeching_time_calc_start', 'maxdlsystem','bitbucket','torrentnameprefix', 'showforumstats','verification','invite_count','invite_timeout', 'seeding_leeching_time_calc_start',
'startsubid', 'logo', 'showlastxforumposts', 'enable_technical_info', 'site_language_enabled', 'show_top_uploader', 'imdb_language', 'startsubid', 'logo', 'showlastxforumposts', 'enable_technical_info', 'site_language_enabled', 'show_top_uploader', 'imdb_language', 'offer_skip_approved_count'
); );
GetVar($validConfig); GetVar($validConfig);
$MAIN = []; $MAIN = [];
@@ -844,6 +844,8 @@ JS;
tr($lang_settings['row_min_offer_votes'],"<input type='text' style=\"width: 100px\" name=minoffervotes value='".($MAIN["minoffervotes"] ? $MAIN["minoffervotes"] : 15)."'> ".$lang_settings['text_min_offer_votes_note'], 1); tr($lang_settings['row_min_offer_votes'],"<input type='text' style=\"width: 100px\" name=minoffervotes value='".($MAIN["minoffervotes"] ? $MAIN["minoffervotes"] : 15)."'> ".$lang_settings['text_min_offer_votes_note'], 1);
tr($lang_settings['row_offer_vote_timeout'],"<input type='text' style=\"width: 100px\" name=offervotetimeout value='".(isset($MAIN["offervotetimeout"]) ? $MAIN["offervotetimeout"] : 259200)."'> ".$lang_settings['text_offer_vote_timeout_note'], 1); tr($lang_settings['row_offer_vote_timeout'],"<input type='text' style=\"width: 100px\" name=offervotetimeout value='".(isset($MAIN["offervotetimeout"]) ? $MAIN["offervotetimeout"] : 259200)."'> ".$lang_settings['text_offer_vote_timeout_note'], 1);
tr($lang_settings['row_offer_upload_timeout'],"<input type='text' style=\"width: 100px\" name=offeruptimeout value='".(isset($MAIN["offeruptimeout"]) ? $MAIN["offeruptimeout"] : 86400)."'> ".$lang_settings['text_offer_upload_timeout_note'], 1); tr($lang_settings['row_offer_upload_timeout'],"<input type='text' style=\"width: 100px\" name=offeruptimeout value='".(isset($MAIN["offeruptimeout"]) ? $MAIN["offeruptimeout"] : 86400)."'> ".$lang_settings['text_offer_upload_timeout_note'], 1);
tr($lang_settings['row_offer_skip_approved_count'],"<input type='text' style=\"width: 100px\" name=offer_skip_approved_count value='".($MAIN["offer_skip_approved_count"] ?? '')."'> ".$lang_settings['text_offer_skip_approved_count_note'], 1);
tr($lang_settings['row_max_subtitle_size'],"<input type='text' style=\"width: 100px\" name=maxsubsize value='".(isset($MAIN["maxsubsize"]) ? $MAIN["maxsubsize"] : 3145728)."'> ". $lang_settings['text_max_subtitle_size_note'], 1); tr($lang_settings['row_max_subtitle_size'],"<input type='text' style=\"width: 100px\" name=maxsubsize value='".(isset($MAIN["maxsubsize"]) ? $MAIN["maxsubsize"] : 3145728)."'> ". $lang_settings['text_max_subtitle_size_note'], 1);
tr($lang_settings['row_posts_per_page'],"<input type='text' style=\"width: 100px\" name=postsperpage value='".($MAIN["postsperpage"] ? $MAIN["postsperpage"] : 10)."'> ".$lang_settings['text_posts_per_page_note'], 1); tr($lang_settings['row_posts_per_page'],"<input type='text' style=\"width: 100px\" name=postsperpage value='".($MAIN["postsperpage"] ? $MAIN["postsperpage"] : 10)."'> ".$lang_settings['text_posts_per_page_note'], 1);
tr($lang_settings['row_topics_per_page'],"<input type='text' style=\"width: 100px\" name=topicsperpage value='".($MAIN["topicsperpage"] ? $MAIN["topicsperpage"] : 20)."'> ".$lang_settings['text_topics_per_page_note'], 1); tr($lang_settings['row_topics_per_page'],"<input type='text' style=\"width: 100px\" name=topicsperpage value='".($MAIN["topicsperpage"] ? $MAIN["topicsperpage"] : 20)."'> ".$lang_settings['text_topics_per_page_note'], 1);
+11 -3
View File
@@ -8,9 +8,17 @@ parked();
if ($CURUSER["uploadpos"] == 'no') if ($CURUSER["uploadpos"] == 'no')
stderr($lang_upload['std_sorry'], $lang_upload['std_unauthorized_to_upload'],false); stderr($lang_upload['std_sorry'], $lang_upload['std_unauthorized_to_upload'],false);
if ($enableoffer == 'yes') if ($enableoffer == 'yes') {
$has_allowed_offer = get_row_count("offers","WHERE allowed='allowed' AND userid = ". sqlesc($CURUSER["id"])); $offerSkipApprovedCount = get_setting('main.offer_skip_approved_count');
else $has_allowed_offer = 0; $allowCount = get_row_count("offers","WHERE allowed='allowed' AND userid = ". sqlesc($CURUSER["id"]));
if (is_numeric($offerSkipApprovedCount) && $offerSkipApprovedCount > 0 && $allowCount >= $offerSkipApprovedCount) {
$has_allowed_offer = true;
} else {
$has_allowed_offer = false;
}
} else {
$has_allowed_offer = false;
}
$uploadfreely = user_can_upload("torrents"); $uploadfreely = user_can_upload("torrents");
$allowtorrents = ($has_allowed_offer || $uploadfreely); $allowtorrents = ($has_allowed_offer || $uploadfreely);
$allowspecial = user_can_upload("music"); $allowspecial = user_can_upload("music");
+3
View File
@@ -91,5 +91,8 @@ return [
'seed_box_record' => [ 'seed_box_record' => [
'toggle_status' => 'Change status', 'toggle_status' => 'Change status',
], ],
'tag' => [
'detach_torrents' => 'Detach all torrents',
],
] ]
]; ];
+1
View File
@@ -160,6 +160,7 @@ return [
'margin' => 'Margin', 'margin' => 'Margin',
'padding' => 'Padding', 'padding' => 'Padding',
'border_radius' => 'Border radius', 'border_radius' => 'Border radius',
'torrents_count' => 'Torrents count',
], ],
'agent_allow' => [ 'agent_allow' => [
'label' => 'Agent allow', 'label' => 'Agent allow',
+3
View File
@@ -91,5 +91,8 @@ return [
'seed_box_record' => [ 'seed_box_record' => [
'toggle_status' => '更改状态', 'toggle_status' => '更改状态',
], ],
'tag' => [
'detach_torrents' => '分离所有种子',
],
] ]
]; ];
+1
View File
@@ -159,6 +159,7 @@ return [
'margin' => '外边距', 'margin' => '外边距',
'padding' => '内边距', 'padding' => '内边距',
'border_radius' => '边框圆角', 'border_radius' => '边框圆角',
'torrents_count' => '种子数',
], ],
'agent_allow' => [ 'agent_allow' => [
'label' => '允许客户端', 'label' => '允许客户端',
+3
View File
@@ -91,5 +91,8 @@ return [
'seed_box_record' => [ 'seed_box_record' => [
'toggle_status' => '更改狀態', 'toggle_status' => '更改狀態',
], ],
'tag' => [
'detach_torrents' => '分離所有種子',
],
] ]
]; ];
+1
View File
@@ -160,6 +160,7 @@ return [
'margin' => '外邊距', 'margin' => '外邊距',
'padding' => '內邊距', 'padding' => '內邊距',
'border_radius' => '邊框圓角', 'border_radius' => '邊框圓角',
'torrents_count' => '種子數',
], ],
'agent_allow' => [ 'agent_allow' => [
'label' => '允許客戶端', 'label' => '允許客戶端',