mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-20 09:30:49 +08:00
improve announce update torrent visible
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
|
||||
|
||||
use App\Events\TorrentUpdated;
|
||||
use App\Http\Resources\TagResource;
|
||||
use App\Models\Ability;
|
||||
use App\Models\Attendance;
|
||||
use App\Models\Exam;
|
||||
use App\Models\ExamProgress;
|
||||
@@ -11,6 +12,7 @@ use App\Models\ExamUser;
|
||||
use App\Models\HitAndRun;
|
||||
use App\Models\Medal;
|
||||
use App\Models\Peer;
|
||||
use App\Models\Role;
|
||||
use App\Models\SearchBox;
|
||||
use App\Models\Snatch;
|
||||
use App\Models\Tag;
|
||||
@@ -44,6 +46,7 @@ use NexusPlugin\PostLike\PostLikeRepository;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotion;
|
||||
use NexusPlugin\StickyPromotion\Models\StickyPromotionParticipator;
|
||||
use Rhilip\Bencode\Bencode;
|
||||
use Silber\Bouncer\Bouncer;
|
||||
|
||||
class Test extends Command
|
||||
{
|
||||
@@ -78,8 +81,7 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$r = NexusDB::cache_get('ssbb');
|
||||
dd($r);
|
||||
Ability::initDefaults();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class TorrentResource extends Resource
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
$showApproval = Setting::get('torrent.approval_status_none_visible') == 'no';
|
||||
$showApproval = Setting::get('torrent.approval_status_none_visible') == 'no' || Setting::get('torrent.approval_status_icon_enabled') == 'yes';
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
|
||||
@@ -55,7 +55,7 @@ class UserResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable(),
|
||||
Tables\Columns\TextColumn::make('id')->sortable()->searchable(),
|
||||
Tables\Columns\TextColumn::make('username')->searchable()->label(__("label.user.username")),
|
||||
Tables\Columns\TextColumn::make('email')->searchable()->label(__("label.email")),
|
||||
Tables\Columns\TextColumn::make('class')->label('Class')
|
||||
|
||||
+2
-2
@@ -17,11 +17,10 @@ use Laravel\Sanctum\HasApiTokens;
|
||||
use Nexus\Database\NexusDB;
|
||||
use Filament\Models\Contracts\FilamentUser;
|
||||
use Filament\Models\Contracts\HasName;
|
||||
use Spatie\Permission\Traits\HasRoles;
|
||||
|
||||
class User extends Authenticatable implements FilamentUser, HasName
|
||||
{
|
||||
use HasFactory, Notifiable, HasApiTokens, HasRoles;
|
||||
use HasFactory, Notifiable, HasApiTokens;
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
@@ -91,6 +90,7 @@ class User extends Authenticatable implements FilamentUser, HasName
|
||||
'invites' => '邀请',
|
||||
];
|
||||
|
||||
|
||||
public function getClassTextAttribute(): string
|
||||
{
|
||||
if (!isset(self::$classes[$this->class]['text'])) {
|
||||
|
||||
@@ -94,7 +94,7 @@ class TorrentPolicy extends BasePolicy
|
||||
|
||||
private function can(User $user)
|
||||
{
|
||||
if ($user->class >= User::CLASS_SYSOP) {
|
||||
if ($user->class >= User::CLASS_ADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -19,7 +19,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function viewAny(User $user)
|
||||
{
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function view(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -42,7 +42,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function create(User $user)
|
||||
{
|
||||
//
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +54,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function update(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
return $this->can($user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -66,7 +66,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function delete(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ class TorrentStatePolicy extends BasePolicy
|
||||
*/
|
||||
public function restore(User $user, TorrentState $torrentState)
|
||||
{
|
||||
//
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -92,4 +92,12 @@ class TorrentStatePolicy extends BasePolicy
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
private function can(User $user)
|
||||
{
|
||||
if ($user->class >= User::CLASS_ADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class UserPolicy extends BasePolicy
|
||||
|
||||
private function can(User $user)
|
||||
{
|
||||
if ($user->class >= User::CLASS_SYSOP) {
|
||||
if ($user->class >= User::CLASS_ADMINISTRATOR) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace App\Providers;
|
||||
|
||||
use App\Auth\NexusWebGuard;
|
||||
use App\Auth\NexusWebUserProvider;
|
||||
use App\Models\Permission;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -36,8 +38,12 @@ class AuthServiceProvider extends ServiceProvider
|
||||
|
||||
Auth::extend('nexus-web', function ($app, $name, array $config) {
|
||||
// 返回 Illuminate\Contracts\Auth\Guard 的实例 ...
|
||||
return new NexusWebGuard($app->make('request'), new NexusWebUserProvider());
|
||||
return new NexusWebGuard($app['request'], new NexusWebUserProvider());
|
||||
});
|
||||
|
||||
// Bouncer::useAbilityModel(Permission::class);
|
||||
// Bouncer::useRoleModel(Role::class);
|
||||
// Bouncer::useUserModel(User::class);
|
||||
}
|
||||
|
||||
private function getUserByCookie($cookie)
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
"orangehill/iseed": "^3.0",
|
||||
"phpgangsta/googleauthenticator": "dev-master",
|
||||
"rhilip/bencode": "^2.0",
|
||||
"spatie/laravel-permission": "^5.5",
|
||||
"spiral/roadrunner": "^2.8"
|
||||
},
|
||||
"require-dev": {
|
||||
|
||||
Generated
+1
-89
@@ -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": "7a9971b631dca4a5322634b89075a35b",
|
||||
"content-hash": "3f8e2bfc2d866abff6ef37466f43be7c",
|
||||
"packages": [
|
||||
{
|
||||
"name": "akaunting/laravel-money",
|
||||
@@ -6181,94 +6181,6 @@
|
||||
],
|
||||
"time": "2022-06-28T14:29:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-permission",
|
||||
"version": "5.5.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/laravel-permission.git",
|
||||
"reference": "f2303a70be60919811ca8afc313e8244fda00974"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/laravel-permission/zipball/f2303a70be60919811ca8afc313e8244fda00974",
|
||||
"reference": "f2303a70be60919811ca8afc313e8244fda00974",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"illuminate/auth": "^7.0|^8.0|^9.0",
|
||||
"illuminate/container": "^7.0|^8.0|^9.0",
|
||||
"illuminate/contracts": "^7.0|^8.0|^9.0",
|
||||
"illuminate/database": "^7.0|^8.0|^9.0",
|
||||
"php": "^7.3|^8.0|^8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^5.0|^6.0|^7.0",
|
||||
"phpunit/phpunit": "^9.4",
|
||||
"predis/predis": "^1.1"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Spatie\\Permission\\PermissionServiceProvider"
|
||||
]
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-main": "5.x-dev",
|
||||
"dev-master": "5.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Spatie\\Permission\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Freek Van der Herten",
|
||||
"email": "freek@spatie.be",
|
||||
"homepage": "https://spatie.be",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "Permission handling for Laravel 6.0 and up",
|
||||
"homepage": "https://github.com/spatie/laravel-permission",
|
||||
"keywords": [
|
||||
"acl",
|
||||
"laravel",
|
||||
"permission",
|
||||
"permissions",
|
||||
"rbac",
|
||||
"roles",
|
||||
"security",
|
||||
"spatie"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/laravel-permission/issues",
|
||||
"source": "https://github.com/spatie/laravel-permission/tree/5.5.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/spatie",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-06-29T23:11:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spiral/goridge",
|
||||
"version": "v3.1.2",
|
||||
|
||||
@@ -1,161 +0,0 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
'models' => [
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your permissions. Of course, it
|
||||
* is often just the "Permission" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Permission model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Permission` contract.
|
||||
*/
|
||||
|
||||
'permission' => Spatie\Permission\Models\Permission::class,
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* Eloquent model should be used to retrieve your roles. Of course, it
|
||||
* is often just the "Role" model but you may use whatever you like.
|
||||
*
|
||||
* The model you want to use as a Role model needs to implement the
|
||||
* `Spatie\Permission\Contracts\Role` contract.
|
||||
*/
|
||||
|
||||
'role' => Spatie\Permission\Models\Role::class,
|
||||
|
||||
],
|
||||
|
||||
'table_names' => [
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'roles' => 'roles',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your permissions. We have chosen a basic
|
||||
* default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'permissions' => 'permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasPermissions" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_permissions' => 'model_has_permissions',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your models roles. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'model_has_roles' => 'model_has_roles',
|
||||
|
||||
/*
|
||||
* When using the "HasRoles" trait from this package, we need to know which
|
||||
* table should be used to retrieve your roles permissions. We have chosen a
|
||||
* basic default value but you may easily change it to any table you like.
|
||||
*/
|
||||
|
||||
'role_has_permissions' => 'role_has_permissions',
|
||||
],
|
||||
|
||||
'column_names' => [
|
||||
/*
|
||||
* Change this if you want to name the related pivots other than defaults
|
||||
*/
|
||||
'role_pivot_key' => null, //default 'role_id',
|
||||
'permission_pivot_key' => null, //default 'permission_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to name the related model primary key other than
|
||||
* `model_id`.
|
||||
*
|
||||
* For example, this would be nice if your primary keys are all UUIDs. In
|
||||
* that case, name this `model_uuid`.
|
||||
*/
|
||||
|
||||
'model_morph_key' => 'model_id',
|
||||
|
||||
/*
|
||||
* Change this if you want to use the teams feature and your related model's
|
||||
* foreign key is other than `team_id`.
|
||||
*/
|
||||
|
||||
'team_foreign_key' => 'team_id',
|
||||
],
|
||||
|
||||
/*
|
||||
* When set to true, the method for checking permissions will be registered on the gate.
|
||||
* Set this to false, if you want to implement custom logic for checking permissions.
|
||||
*/
|
||||
|
||||
'register_permission_check_method' => true,
|
||||
|
||||
/*
|
||||
* When set to true the package implements teams using the 'team_foreign_key'. If you want
|
||||
* the migrations to register the 'team_foreign_key', you must set this to true
|
||||
* before doing the migration. If you already did the migration then you must make a new
|
||||
* migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
|
||||
* 'model_has_permissions'(view the latest version of package's migration file)
|
||||
*/
|
||||
|
||||
'teams' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required permission names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_permission_in_exception' => false,
|
||||
|
||||
/*
|
||||
* When set to true, the required role names are added to the exception
|
||||
* message. This could be considered an information leak in some contexts, so
|
||||
* the default setting is false here for optimum safety.
|
||||
*/
|
||||
|
||||
'display_role_in_exception' => false,
|
||||
|
||||
/*
|
||||
* By default wildcard permission lookups are disabled.
|
||||
*/
|
||||
|
||||
'enable_wildcard_permission' => false,
|
||||
|
||||
'cache' => [
|
||||
|
||||
/*
|
||||
* By default all permissions are cached for 24 hours to speed up performance.
|
||||
* When permissions or roles are updated the cache is flushed automatically.
|
||||
*/
|
||||
|
||||
'expiration_time' => \DateInterval::createFromDateString('24 hours'),
|
||||
|
||||
/*
|
||||
* The cache key used to store all permissions.
|
||||
*/
|
||||
|
||||
'key' => 'spatie.permission.cache',
|
||||
|
||||
/*
|
||||
* You may optionally indicate a specific cache driver to use for permission and
|
||||
* role caching using any of the `store` drivers listed in the cache.php config
|
||||
* file. Using 'default' here means to use the `default` set in cache.php.
|
||||
*/
|
||||
|
||||
'store' => 'default',
|
||||
],
|
||||
];
|
||||
@@ -1,141 +0,0 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
class CreatePermissionTables extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$teams = config('permission.teams');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
|
||||
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
}
|
||||
|
||||
Schema::create($tableNames['permissions'], function (Blueprint $table) {
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name', 125); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name', 125); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name', 125); // For MySQL 8.0 use string('name', 125);
|
||||
$table->string('guard_name', 125); // For MySQL 8.0 use string('guard_name', 125);
|
||||
$table->timestamps();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotPermission);
|
||||
$table->unsignedBigInteger(PermissionRegistrar::$pivotRole);
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign(PermissionRegistrar::$pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([PermissionRegistrar::$pivotPermission, PermissionRegistrar::$pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
if (empty($tableNames)) {
|
||||
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
}
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.17');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-07-05');
|
||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.7.18');
|
||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2022-07-12');
|
||||
defined('IN_TRACKER') || define('IN_TRACKER', true);
|
||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||
|
||||
+14
-7
@@ -443,6 +443,7 @@ else // continue an existing session
|
||||
|
||||
$dt = sqlesc(date("Y-m-d H:i:s"));
|
||||
$updateset = array();
|
||||
$hasChangeSeederLeecher = false;
|
||||
// set non-type event
|
||||
if (!isset($event))
|
||||
$event = "";
|
||||
@@ -452,6 +453,7 @@ if (isset($self) && $event == "stopped")
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
// $updateset[] = ($self["seeder"] == "yes" ? "seeders = seeders - 1" : "leechers = leechers - 1");
|
||||
$hasChangeSeederLeecher = true;
|
||||
sql_query("UPDATE snatched SET uploaded = uploaded + $trueupthis, downloaded = downloaded + $truedownthis, to_go = $left, $announcetime, last_action = ".$dt." WHERE torrentid = $torrentid AND userid = $userid") or err("SL Err 1");
|
||||
}
|
||||
}
|
||||
@@ -470,9 +472,10 @@ elseif(isset($self))
|
||||
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
// if ($seeder <> $self["seeder"])
|
||||
//count directly since 1.7.4
|
||||
// $updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
|
||||
if ($seeder <> $self["seeder"]) {
|
||||
// $updateset[] = ($seeder == "yes" ? "seeders = seeders + 1, leechers = leechers - 1" : "seeders = seeders - 1, leechers = leechers + 1");
|
||||
$hasChangeSeederLeecher = true;
|
||||
}
|
||||
$snatchInfo = \App\Models\Snatch::query()
|
||||
->where('torrentid', $torrentid)
|
||||
->where('userid', $userid)
|
||||
@@ -524,7 +527,7 @@ else
|
||||
if (mysql_affected_rows())
|
||||
{
|
||||
// $updateset[] = ($seeder == "yes" ? "seeders = seeders + 1" : "leechers = leechers + 1");
|
||||
|
||||
$hasChangeSeederLeecher = true;
|
||||
$check = @mysql_fetch_row(@sql_query("SELECT COUNT(*) FROM snatched WHERE torrentid = $torrentid AND userid = $userid"));
|
||||
if (!$check['0'])
|
||||
sql_query("INSERT INTO snatched (torrentid, userid, ip, port, uploaded, downloaded, to_go, startdat, last_action) VALUES ($torrentid, $userid, ".sqlesc($ip).", $port, $uploaded, $downloaded, $left, $dt, $dt)") or err("SL Err 4");
|
||||
@@ -548,11 +551,13 @@ if (isset($event) && !empty($event)) {
|
||||
$updateset[] = 'leechers = ' . get_row_count("peers", "where torrent = $torrentid and to_go > 0");
|
||||
}
|
||||
|
||||
if (count($updateset)) // Update only when there is change in peer counts
|
||||
if (count($updateset) || $hasChangeSeederLeecher) // Update only when there is change in peer counts
|
||||
{
|
||||
$updateset[] = "visible = 'yes'";
|
||||
$updateset[] = "last_action = $dt";
|
||||
sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
|
||||
$sql = "UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid";
|
||||
sql_query($sql);
|
||||
do_log("[ANNOUNCE_UPDATE_TORRENT], $sql");
|
||||
}
|
||||
|
||||
if($client_familyid != 0 && $client_familyid != $az['clientselect']) {
|
||||
@@ -571,7 +576,9 @@ if ($az['class'] == UC_VIP) {
|
||||
}
|
||||
if(count($USERUPDATESET) && $userid)
|
||||
{
|
||||
sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid);
|
||||
$sql = "UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid;
|
||||
sql_query($sql);
|
||||
do_log("[ANNOUNCE_UPDATE_USER], $sql");
|
||||
}
|
||||
do_action('announced', $torrent, $az, $_REQUEST);
|
||||
benc_resp($rep_dict);
|
||||
|
||||
+1
-1
@@ -156,7 +156,7 @@ if (!$row) {
|
||||
if (get_user_class() >= $askreseed_class && $row['seeders'] == 0) {
|
||||
$actions[] = "<a title=\"".$lang_details['title_ask_for_reseed']."\" href=\"takereseed.php?reseedid=$id\"><img class=\"dt_reseed\" src=\"pic/trans.gif\" alt=\"reseed\"> <b><font class=\"small\">".$lang_details['text_ask_for_reseed'] ."</font></b></a>";
|
||||
}
|
||||
if (get_user_class() >= $torrentmanage_class && get_setting('torrent.approval_status_none_visible') == 'no') {
|
||||
if (get_user_class() >= $torrentmanage_class && (get_setting('torrent.approval_status_icon_enabled') == 'yes' || get_setting('torrent.approval_status_none_visible') == 'no')) {
|
||||
$approvalIcon = '<svg t="1655224943277" class="icon" viewBox="0 0 1397 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="45530" width="16" height="16"><path d="M1396.363636 121.018182c0 0-223.418182 74.472727-484.072727 372.363636-242.036364 269.963636-297.890909 381.672727-390.981818 530.618182C512 1014.690909 372.363636 744.727273 0 549.236364l195.490909-186.181818c0 0 176.872727 121.018182 297.890909 344.436364 0 0 307.2-474.763636 902.981818-707.490909L1396.363636 121.018182 1396.363636 121.018182zM1396.363636 121.018182" p-id="45531" fill="#e78d0f"></path></svg>';
|
||||
$actions[] = sprintf(
|
||||
'<a href="javascript:;"><b><font id="approval" class="small approval" data-torrent_id="%s">%s %s</font></b></a>',
|
||||
|
||||
@@ -36,8 +36,10 @@ function dltable($name, $arr, $torrent)
|
||||
"<td class=colhead align=center width=1%>".$lang_viewpeerlist['col_client']."</td></tr>\n";
|
||||
$now = time();
|
||||
$num = 0;
|
||||
$privacyData = \App\Models\User::query()->whereIn('id', array_column($arr, 'userid'))->get(['id', 'privacy'])->keyBy('id');
|
||||
foreach ($arr as $e) {
|
||||
$privacy = get_single_value("users", "privacy","WHERE id=".sqlesc($e['userid']));
|
||||
// $privacy = get_single_value("users", "privacy","WHERE id=".sqlesc($e['userid']));
|
||||
$privacy = $privacyData->get($e['userid'])->privacy ?? '';
|
||||
++$num;
|
||||
|
||||
$highlight = $CURUSER["id"] == $e['userid'] ? " bgcolor=#BBAF9B" : "";
|
||||
|
||||
@@ -15,6 +15,8 @@ return [
|
||||
'claims' => 'User claims',
|
||||
'torrent_list' => 'Torrents',
|
||||
'torrent_state' => 'Free leach',
|
||||
'roles_list' => 'Roles',
|
||||
'ability_list' => 'Permissions',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
@@ -83,6 +83,9 @@ return [
|
||||
'duration' => 'Duration',
|
||||
'duration_help' => 'Unit: days. If left blank, the user has permanent possession',
|
||||
],
|
||||
'user_medal' => [
|
||||
'label' => 'User medal',
|
||||
],
|
||||
'exam' => [
|
||||
'label' => 'Exam',
|
||||
'is_done' => 'Is done',
|
||||
@@ -106,6 +109,7 @@ return [
|
||||
'index_result' => 'Result',
|
||||
],
|
||||
'exam_user' => [
|
||||
'label' => 'Exam user',
|
||||
'is_done' => 'Is done',
|
||||
],
|
||||
'torrent' => [
|
||||
@@ -123,7 +127,7 @@ return [
|
||||
'visible' => 'Visible',
|
||||
],
|
||||
'hit_and_run' => [
|
||||
|
||||
'label' => 'User H&R',
|
||||
],
|
||||
'tag' => [
|
||||
'label' => 'Tag',
|
||||
@@ -135,6 +139,7 @@ return [
|
||||
'border_radius' => 'Border radius',
|
||||
],
|
||||
'agent_allow' => [
|
||||
'label' => 'Agent allow',
|
||||
'family' => 'Family',
|
||||
'start_name' => 'Start name',
|
||||
'peer_id_start' => 'Peer ID start',
|
||||
@@ -149,16 +154,22 @@ return [
|
||||
'allowhttps' => 'Allow https',
|
||||
],
|
||||
'agent_deny' => [
|
||||
'label' => 'Agent deny',
|
||||
'peer_id' => 'Peer ID',
|
||||
'agent' => 'Agent',
|
||||
],
|
||||
'claim' => [
|
||||
'label' => 'User claim',
|
||||
'last_settle_at' => 'Last settle at',
|
||||
'seed_time_this_month' => 'St. this month',
|
||||
'uploaded_this_month' => 'Up. this month',
|
||||
'is_reached_this_month' => 'Reached',
|
||||
],
|
||||
'torrent_state' => [
|
||||
'label' => 'Global promotion',
|
||||
'global_sp_state' => 'Global promotion state',
|
||||
],
|
||||
'role' => [
|
||||
'class' => 'Relate user class',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -15,6 +15,8 @@ return [
|
||||
'claims' => '用户认领',
|
||||
'torrent_list' => '种子',
|
||||
'torrent_state' => '全站优惠',
|
||||
'roles_list' => '角色',
|
||||
'ability_list' => '权限',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
@@ -83,6 +83,9 @@ return [
|
||||
'duration' => '有效时长',
|
||||
'duration_help' => '单位:天。如果留空,用户永久拥有',
|
||||
],
|
||||
'user_medal' => [
|
||||
'label' => '用户勋章',
|
||||
],
|
||||
'exam' => [
|
||||
'label' => '考核',
|
||||
'is_discovered' => '自动发现',
|
||||
@@ -105,6 +108,7 @@ return [
|
||||
'index_result' => '结果',
|
||||
],
|
||||
'exam_user' => [
|
||||
'label' => '用户考核',
|
||||
'is_done' => '是否完成',
|
||||
],
|
||||
'torrent' => [
|
||||
@@ -122,7 +126,7 @@ return [
|
||||
'visible' => '活种',
|
||||
],
|
||||
'hit_and_run' => [
|
||||
|
||||
'label' => '用户 H&R',
|
||||
],
|
||||
'tag' => [
|
||||
'label' => '标签',
|
||||
@@ -134,6 +138,7 @@ return [
|
||||
'border_radius' => '边框圆角',
|
||||
],
|
||||
'agent_allow' => [
|
||||
'label' => '允许客户端',
|
||||
'family' => '系列',
|
||||
'start_name' => '起始名称',
|
||||
'peer_id_start' => 'Peer ID 超始',
|
||||
@@ -148,16 +153,26 @@ return [
|
||||
'allowhttps' => '允许 https',
|
||||
],
|
||||
'agent_deny' => [
|
||||
'label' => '拒绝客戶端',
|
||||
'peer_id' => 'Peer ID',
|
||||
'agent' => 'Agent',
|
||||
],
|
||||
'claim' => [
|
||||
'label' => '用户认领',
|
||||
'last_settle_at' => '上次结算时间',
|
||||
'seed_time_this_month' => '本月做种时间',
|
||||
'uploaded_this_month' => '本月上传量',
|
||||
'is_reached_this_month' => '本月是否达标',
|
||||
],
|
||||
'torrent_state' => [
|
||||
'label' => '全站优惠',
|
||||
'global_sp_state' => '全站优惠',
|
||||
],
|
||||
'role' => [
|
||||
'class' => '关联用户等级',
|
||||
],
|
||||
'ability' => [
|
||||
'name' => '标识',
|
||||
'title' => '名称',
|
||||
],
|
||||
];
|
||||
|
||||
@@ -15,6 +15,8 @@ return [
|
||||
'claims' => '用戶認領',
|
||||
'torrent_list' => '種子',
|
||||
'torrent_state' => '全站優惠',
|
||||
'roles_list' => '角色',
|
||||
'ability_list' => '權限',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
@@ -83,6 +83,9 @@ return [
|
||||
'duration' => '有效時長',
|
||||
'duration_help' => '單位:天。如果留空,用戶永久擁有',
|
||||
],
|
||||
'user_medal' => [
|
||||
'label' => '用戶勛章',
|
||||
],
|
||||
'exam' => [
|
||||
'label' => '考核',
|
||||
'is_done' => '是否完成',
|
||||
@@ -106,6 +109,7 @@ return [
|
||||
'index_result' => '結果',
|
||||
],
|
||||
'exam_user' => [
|
||||
'label' => '用戶考核',
|
||||
'is_done' => '是否完成',
|
||||
],
|
||||
'torrent' => [
|
||||
@@ -123,7 +127,7 @@ return [
|
||||
'visible' => '活種',
|
||||
],
|
||||
'hit_and_run' => [
|
||||
|
||||
'label' => '用戶 H&R',
|
||||
],
|
||||
'tag' => [
|
||||
'label' => '標簽',
|
||||
@@ -135,6 +139,7 @@ return [
|
||||
'border_radius' => '邊框圓角',
|
||||
],
|
||||
'agent_allow' => [
|
||||
'label' => '允許客戶端',
|
||||
'family' => '系列',
|
||||
'start_name' => '起始名稱',
|
||||
'peer_id_start' => 'Peer ID 超始',
|
||||
@@ -149,16 +154,22 @@ return [
|
||||
'allowhttps' => '允許 https',
|
||||
],
|
||||
'agent_deny' => [
|
||||
'label' => '拒絕客戶端',
|
||||
'peer_id' => 'Peer ID',
|
||||
'agent' => 'Agent',
|
||||
],
|
||||
'claim' => [
|
||||
'label' => '用戶認領',
|
||||
'last_settle_at' => '上次結算時間',
|
||||
'seed_time_this_month' => '本月做種時間',
|
||||
'uploaded_this_month' => '本月上傳量',
|
||||
'is_reached_this_month' => '本月是否達標',
|
||||
],
|
||||
'torrent_state' => [
|
||||
'label' => '全站優惠',
|
||||
'global_sp_state' => '全站優惠',
|
||||
],
|
||||
'role' => [
|
||||
'class' => '關聯用户等級',
|
||||
],
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user