1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-25 01:05:36 +00:00

Merge pull request #901 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2019-02-27 21:13:05 -07:00 committed by GitHub
commit d0f913831c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View file

@ -7,7 +7,7 @@ use App\Http\Controllers\{
Controller,
AvatarController
};
use Auth, Cache, URL;
use Auth, Cache, Storage, URL;
use Carbon\Carbon;
use App\{
Avatar,
@ -290,6 +290,27 @@ class BaseApiController extends Controller
return response()->json($res);
}
public function deleteMedia(Request $request)
{
$this->validate($request, [
'id' => 'required|integer|min:1|exists:media,id'
]);
$media = Media::whereNull('status_id')
->whereUserId(Auth::id())
->findOrFail($request->input('id'));
Storage::delete($media->media_path);
Storage::delete($media->thumbnail_path);
$media->forceDelete();
return response()->json([
'msg' => 'Successfully deleted',
'code' => 200
]);
}
public function verifyCredentials(Request $request)
{
$profile = Auth::user()->profile;

View file

@ -77,6 +77,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::post('avatar/update', 'ApiController@avatarUpdate');
Route::get('likes', 'ApiController@hydrateLikes');
Route::post('media', 'ApiController@uploadMedia');
Route::delete('media', 'ApiController@deleteMedia');
Route::get('notifications', 'ApiController@notifications');
Route::get('timelines/public', 'PublicApiController@publicTimelineApi');
Route::get('timelines/home', 'PublicApiController@homeTimelineApi');
@ -214,6 +215,9 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
Route::get('applications', 'SettingsController@applications')->name('settings.applications')->middleware('dangerzone');
Route::get('data-export', 'SettingsController@dataExport')->name('settings.dataexport');
Route::post('data-export/following', 'SettingsController@exportFollowing');
Route::post('data-export/followers', 'SettingsController@exportFollowers');
Route::post('data-export/mute-block-list', 'SettingsController@exportMuteBlockList');
Route::get('developers', 'SettingsController@developers')->name('settings.developers')->middleware('dangerzone');
});