diff --git a/app/Http/Controllers/Api/AdminApiController.php b/app/Http/Controllers/Api/AdminApiController.php index dfacf47ee..902b00536 100644 --- a/app/Http/Controllers/Api/AdminApiController.php +++ b/app/Http/Controllers/Api/AdminApiController.php @@ -68,6 +68,8 @@ class AdminApiController extends Controller public function moderateStatus(Request $request) { + abort(400, 'Unpublished API'); + return; $this->validate($request, [ 'type' => 'required|string|in:status,profile', 'id' => 'required|integer|min:1', diff --git a/app/Http/Controllers/FollowerController.php b/app/Http/Controllers/FollowerController.php index 5ed9b1709..bd3f4b674 100644 --- a/app/Http/Controllers/FollowerController.php +++ b/app/Http/Controllers/FollowerController.php @@ -23,16 +23,11 @@ class FollowerController extends Controller public function store(Request $request) { $this->validate($request, [ - 'item' => 'required|integer', + 'item' => 'required|string', ]); - $item = $request->input('item'); + $item = (int) $request->input('item'); $this->handleFollowRequest($item); - if($request->wantsJson()) { - return response()->json([ - 200 - ], 200); - } - return redirect()->back(); + return response()->json(200); } protected function handleFollowRequest($item) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 2d5e69091..89f504079 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -95,7 +95,6 @@ class SettingsController extends Controller $user = Auth::user(); abort_if(!config('pixelfed.account_deletion'), 403); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subHours(12)), 403); return view('settings.remove.temporary'); } @@ -105,7 +104,6 @@ class SettingsController extends Controller $user = Auth::user(); abort_if(!config('pixelfed.account_deletion'), 403); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subHours(12)), 403); $profile = $user->profile; $user->status = 'disabled'; $profile->status = 'disabled'; @@ -120,7 +118,6 @@ class SettingsController extends Controller { $user = Auth::user(); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subDays(7)), 403); return view('settings.remove.permanent'); } @@ -132,7 +129,6 @@ class SettingsController extends Controller $user = Auth::user(); abort_if(!config('pixelfed.account_deletion'), 403); abort_if($user->is_admin, 403); - abort_if($user->created_at->gt(now()->subDays(7)), 403); $profile = $user->profile; $ts = Carbon::now()->addMonth(); $user->status = 'delete'; diff --git a/resources/assets/js/components/ComposeClassic.vue b/resources/assets/js/components/ComposeClassic.vue new file mode 100644 index 000000000..df751cb71 --- /dev/null +++ b/resources/assets/js/components/ComposeClassic.vue @@ -0,0 +1,523 @@ + + + + \ No newline at end of file diff --git a/resources/assets/js/components/Profile.vue b/resources/assets/js/components/Profile.vue index 53a86f37c..353302737 100644 --- a/resources/assets/js/components/Profile.vue +++ b/resources/assets/js/components/Profile.vue @@ -187,11 +187,11 @@ - -
-
-

-

No posts yet

+
+
+

+

No posts yet

+
@@ -290,10 +290,10 @@ - + - +
@@ -960,12 +960,10 @@ return o; }, - followProfile($event) { + followProfile() { if($('body').hasClass('loggedIn') == false) { return; } - $event.target.setAttribute('disabled',''); - $event.target.blur(); axios.post('/i/follow', { item: this.profileId }).then(res => { @@ -979,7 +977,6 @@ this.profile.followers_count++; } this.relationship.following = !this.relationship.following; - $event.target.removeAttribute('disabled'); }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); diff --git a/resources/assets/js/components/SearchResults.vue b/resources/assets/js/components/SearchResults.vue index e93354190..13b0e1421 100644 --- a/resources/assets/js/components/SearchResults.vue +++ b/resources/assets/js/components/SearchResults.vue @@ -57,9 +57,9 @@ {{profile.value}}

- + + +

@@ -140,12 +140,19 @@ export default { }) }, - followProfile(id) { - // todo: finish AP Accept handling to enable remote follows + followProfile(profile, index) { + this.loading = true; axios.post('/i/follow', { - item: id + item: profile.entity.id }).then(res => { - window.location.href = window.location.href; + if(profile.entity.local == true) { + this.fetchSearchResults(); + return; + } else { + this.loading = false; + this.results.profiles[index].entity.follow_request = true; + return; + } }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); diff --git a/resources/assets/js/compose-classic.js b/resources/assets/js/compose-classic.js new file mode 100644 index 000000000..83cbc1174 --- /dev/null +++ b/resources/assets/js/compose-classic.js @@ -0,0 +1,4 @@ +Vue.component( + 'compose-classic', + require('./components/ComposeClassic.vue').default +); \ No newline at end of file diff --git a/resources/views/settings/security.blade.php b/resources/views/settings/security.blade.php index c0acc4a7c..b0802d402 100644 --- a/resources/views/settings/security.blade.php +++ b/resources/views/settings/security.blade.php @@ -27,7 +27,7 @@ @include('settings.security.device-panel') - @if(config('pixelfed.account_deletion') && !$user->is_admin && $user->created_at->lt(now()->subHours(12))) + @if(config('pixelfed.account_deletion') && !$user->is_admin)

Danger Zone

- @if(!$user->is_admin && $user->created_at->lt(now()->subDays(7)) )
  • Delete this Account

    @@ -50,7 +49,6 @@ Delete
  • - @endif @endif diff --git a/resources/views/status/compose.blade.php b/resources/views/status/compose.blade.php index 8ced6f0df..fef86bc57 100644 --- a/resources/views/status/compose.blade.php +++ b/resources/views/status/compose.blade.php @@ -2,26 +2,31 @@ @section('content') -
    +{{--
    -

    The Classic Compose UI has been retired.

    +

    Compose New Post

    New Post

    +
    --}} + + @endsection @push('scripts') - + + @endpush \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index b04997e48..141fac2dd 100644 --- a/routes/web.php +++ b/routes/web.php @@ -102,13 +102,13 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::get('status/{id}/replies', 'InternalApiController@statusReplies'); Route::post('moderator/action', 'InternalApiController@modAction'); Route::get('discover/categories', 'InternalApiController@discoverCategories'); - Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); Route::get('loops', 'DiscoverController@loopsApi'); Route::post('loops/watch', 'DiscoverController@loopWatch'); Route::get('discover/tag', 'DiscoverController@getHashtags'); + Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); }); Route::group(['prefix' => 'local'], function () { - Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); + Route::post('status/compose', 'InternalApiController@composePost')->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440'); Route::get('exp/rec', 'ApiController@userRecommendations'); Route::post('discover/tag/subscribe', 'HashtagFollowController@store')->middleware('throttle:maxHashtagFollowsPerHour,60')->middleware('throttle:maxHashtagFollowsPerDay,1440');; Route::get('discover/tag/list', 'HashtagFollowController@getTags'); @@ -122,6 +122,10 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact Route::post('collection/{id}/publish', 'CollectionController@publish')->middleware('throttle:maxCollectionsPerHour,60')->middleware('throttle:maxCollectionsPerDay,1440')->middleware('throttle:maxCollectionsPerMonth,43800'); Route::get('profile/collections/{id}', 'CollectionController@getUserCollections'); }); + Route::group(['prefix' => 'admin'], function () { + Route::post('moderate', 'Api\AdminApiController@moderate'); + }); + }); Route::get('discover/tags/{hashtag}', 'DiscoverController@showTags'); diff --git a/webpack.mix.js b/webpack.mix.js index 64ab467e4..faafe51b0 100644 --- a/webpack.mix.js +++ b/webpack.mix.js @@ -21,6 +21,7 @@ mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/status.js', 'public/js') .js('resources/assets/js/timeline.js', 'public/js') .js('resources/assets/js/compose.js', 'public/js') +.js('resources/assets/js/compose-classic.js', 'public/js') .js('resources/assets/js/search.js', 'public/js') .js('resources/assets/js/developers.js', 'public/js') .js('resources/assets/js/loops.js', 'public/js') @@ -33,6 +34,7 @@ mix.js('resources/assets/js/app.js', 'public/js') .js('resources/assets/js/hashtag.js', 'public/js') .js('resources/assets/js/collectioncompose.js', 'public/js') .js('resources/assets/js/collections.js', 'public/js') +//.js('resources/assets/js/admin.js', 'public/js') .extract([ 'lodash',