mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Retire Classic Compose UI
This commit is contained in:
parent
24b8f6faa9
commit
72bffd16d4
6 changed files with 37 additions and 28 deletions
|
@ -101,6 +101,8 @@ class StatusController extends Controller
|
||||||
|
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
|
||||||
$this->authCheck();
|
$this->authCheck();
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,11 @@ use Laravel\Passport\HasApiTokens;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
|
use App\Util\RateLimit\User as UserRateLimit;
|
||||||
|
|
||||||
class User extends Authenticatable
|
class User extends Authenticatable
|
||||||
{
|
{
|
||||||
use Notifiable, SoftDeletes, HasApiTokens;
|
use Notifiable, SoftDeletes, HasApiTokens, UserRateLimit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The attributes that should be mutated to dates.
|
* The attributes that should be mutated to dates.
|
||||||
|
@ -76,4 +77,5 @@ class User extends Authenticatable
|
||||||
{
|
{
|
||||||
return $this->hasMany(UserDevice::class);
|
return $this->hasMany(UserDevice::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
26
app/Util/RateLimit/User.php
Normal file
26
app/Util/RateLimit/User.php
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Util\RateLimit;
|
||||||
|
|
||||||
|
trait User {
|
||||||
|
|
||||||
|
public function getMaxPostsPerHourAttribute()
|
||||||
|
{
|
||||||
|
return 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxPostsPerDayAttribute()
|
||||||
|
{
|
||||||
|
return 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxCommentsPerHourAttribute()
|
||||||
|
{
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getMaxCommentsPerDayAttribute()
|
||||||
|
{
|
||||||
|
return 500;
|
||||||
|
}
|
||||||
|
}
|
|
@ -202,10 +202,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-footer py-1">
|
|
||||||
<p class="text-center mb-0 font-weight-bold text-muted small">Having issues? You can also use the <a href="/i/compose">Classic Compose UI</a>.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,10 @@
|
||||||
<div class="container mt-5">
|
<div class="container mt-5">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 col-md-6 offset-md-3">
|
<div class="col-12 col-md-6 offset-md-3">
|
||||||
@include('timeline.partial.new-form')
|
<p class="lead text-center font-weight-bold">The Classic Compose UI has been retired.</p>
|
||||||
|
<p class="lead text-center">
|
||||||
|
<a href="javascript:void(0)" class="btn btn-primary font-weight-bold" data-toggle="modal" data-target="#composeModal">New Post</a>
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,25 +22,6 @@ $(document).ready(function() {
|
||||||
new Vue({
|
new Vue({
|
||||||
el: '#content'
|
el: '#content'
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.metro-classic-compose textarea[name="caption"]').on('click', function(e) {
|
|
||||||
let el = $(this);
|
|
||||||
el.attr('rows', 4);
|
|
||||||
});
|
|
||||||
$('.metro-classic-compose textarea[name="caption"]').on('change keyup paste', function(e) {
|
|
||||||
let el = $(this);
|
|
||||||
let len = el.val().length;
|
|
||||||
let limit = el.attr('data-limit');
|
|
||||||
|
|
||||||
let res = len;
|
|
||||||
|
|
||||||
if(len > limit) {
|
|
||||||
res = '<span class="text-danger">' + (limit - len) + '</span>';
|
|
||||||
} else {
|
|
||||||
res = '<span>' + len + '</span>';
|
|
||||||
}
|
|
||||||
$('.metro-classic-compose .caption-counter').html(res);
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@endpush
|
@endpush
|
|
@ -99,7 +99,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::get('status/{id}/replies', 'InternalApiController@statusReplies');
|
Route::get('status/{id}/replies', 'InternalApiController@statusReplies');
|
||||||
Route::post('moderator/action', 'InternalApiController@modAction');
|
Route::post('moderator/action', 'InternalApiController@modAction');
|
||||||
Route::get('discover/categories', 'InternalApiController@discoverCategories');
|
Route::get('discover/categories', 'InternalApiController@discoverCategories');
|
||||||
Route::post('status/compose', 'InternalApiController@composePost');
|
Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440');
|
||||||
Route::get('loops', 'DiscoverController@loopsApi');
|
Route::get('loops', 'DiscoverController@loopsApi');
|
||||||
Route::post('loops/watch', 'DiscoverController@loopWatch');
|
Route::post('loops/watch', 'DiscoverController@loopWatch');
|
||||||
});
|
});
|
||||||
|
@ -115,7 +115,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::group(['prefix' => 'i'], function () {
|
Route::group(['prefix' => 'i'], function () {
|
||||||
Route::redirect('/', '/');
|
Route::redirect('/', '/');
|
||||||
Route::get('compose', 'StatusController@compose')->name('compose');
|
Route::get('compose', 'StatusController@compose')->name('compose');
|
||||||
Route::post('comment', 'CommentController@store');
|
Route::post('comment', 'CommentController@store')->middleware('throttle:maxCommentsPerHour,60')->middleware('throttle:maxCommentsPerDay,1440');
|
||||||
Route::post('delete', 'StatusController@delete');
|
Route::post('delete', 'StatusController@delete');
|
||||||
Route::post('mute', 'AccountController@mute');
|
Route::post('mute', 'AccountController@mute');
|
||||||
Route::post('unmute', 'AccountController@unmute');
|
Route::post('unmute', 'AccountController@unmute');
|
||||||
|
@ -294,7 +294,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::group(['prefix' => 'timeline'], function () {
|
Route::group(['prefix' => 'timeline'], function () {
|
||||||
Route::redirect('/', '/');
|
Route::redirect('/', '/');
|
||||||
Route::get('public', 'TimelineController@local')->name('timeline.public');
|
Route::get('public', 'TimelineController@local')->name('timeline.public');
|
||||||
Route::post('public', 'StatusController@store');
|
|
||||||
// Route::get('network', 'TimelineController@network')->name('timeline.network');
|
// Route::get('network', 'TimelineController@network')->name('timeline.network');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue