mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 13:33:18 +00:00
commit
77eb3a9a52
28 changed files with 864 additions and 523 deletions
|
@ -34,6 +34,8 @@
|
|||
- Updated ApiV1Controller, fix broken auth check on public timelines. Fixes ([#2168](https://github.com/pixelfed/pixelfed/issues/2168)) ([aa49afc7](https://github.com/pixelfed/pixelfed/commit/aa49afc7))
|
||||
- Updated SearchApiV2Service, fix offset bug ([#2116](https://github.com/pixelfed/pixelfed/issues/2116)) ([a0c0c84d](https://github.com/pixelfed/pixelfed/commit/a0c0c84d))
|
||||
- Updated api routes, fixes ([#2114](https://github.com/pixelfed/pixelfed/issues/2114)) ([50bbeddd](https://github.com/pixelfed/pixelfed/commit/50bbeddd))
|
||||
- Updated SiteController, add legacy profile/webfinger redirect ([cfaa248c](https://github.com/pixelfed/pixelfed/commit/cfaa248c))
|
||||
- Updated checkpoint view, fix recovery code bug ([3385583f](https://github.com/pixelfed/pixelfed/commit/3385583f))
|
||||
|
||||
|
||||
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
|
||||
|
|
|
@ -1901,6 +1901,59 @@ class ApiV1Controller extends Controller
|
|||
return response()->json($res, 200, [], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/v1/statuses/{id}/bookmark
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return StatusTransformer
|
||||
*/
|
||||
public function bookmarkStatus(Request $request, $id)
|
||||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$status = Status::whereNull('uri')
|
||||
->whereScope('public')
|
||||
->findOrFail($id);
|
||||
|
||||
Bookmark::firstOrCreate([
|
||||
'status_id' => $status->id,
|
||||
'profile_id' => $request->user()->profile_id
|
||||
]);
|
||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/v1/statuses/{id}/unbookmark
|
||||
*
|
||||
*
|
||||
*
|
||||
* @return StatusTransformer
|
||||
*/
|
||||
public function unbookmarkStatus(Request $request, $id)
|
||||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$status = Status::whereNull('uri')
|
||||
->whereScope('public')
|
||||
->findOrFail($id);
|
||||
|
||||
Bookmark::firstOrCreate([
|
||||
'status_id' => $status->id,
|
||||
'profile_id' => $request->user()->profile_id
|
||||
]);
|
||||
$bookmark = Bookmark::whereStatusId($status->id)
|
||||
->whereProfileId($request->user()->profile_id)
|
||||
->firstOrFail();
|
||||
$bookmark->delete();
|
||||
|
||||
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v2/search
|
||||
*
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Str;
|
||||
use App, Auth, Cache, View;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use App\{Follower, Page, Profile, Status, User, UserFilter};
|
||||
|
@ -129,4 +130,27 @@ class SiteController extends Controller
|
|||
$following = $user != null ? FollowerService::follows($user->profile_id, $profile->id) : false;
|
||||
return view('site.intents.follow', compact('profile', 'user', 'following'));
|
||||
}
|
||||
|
||||
public function legacyProfileRedirect(Request $request, $username)
|
||||
{
|
||||
$username = Str::contains($username, '@') ? '@' . $username : $username;
|
||||
if(str_contains($username, '@')) {
|
||||
$profile = Profile::whereUsername($username)
|
||||
->firstOrFail();
|
||||
|
||||
if($profile->domain == null) {
|
||||
$url = "/$profile->username";
|
||||
} else {
|
||||
$url = "/i/web/profile/_/{$profile->id}";
|
||||
}
|
||||
|
||||
} else {
|
||||
$profile = Profile::whereUsername($username)
|
||||
->whereNull('domain')
|
||||
->firstOrFail();
|
||||
$url = "/$profile->username";
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -285,7 +285,7 @@ class Helpers {
|
|||
}
|
||||
}
|
||||
|
||||
if(!self::validateUrl($activity['object']['id']) ||
|
||||
if(!self::validateUrl($res['id']) ||
|
||||
!self::validateUrl($activity['object']['attributedTo'])
|
||||
) {
|
||||
return;
|
||||
|
@ -400,7 +400,10 @@ class Helpers {
|
|||
return;
|
||||
}
|
||||
$domain = parse_url($res['id'], PHP_URL_HOST);
|
||||
$username = (string) Purify::clean($res['preferredUsername']);
|
||||
if(!isset($res['preferredUsername']) && !isset($res['nickname'])) {
|
||||
return;
|
||||
}
|
||||
$username = (string) Purify::clean($res['preferredUsername'] ?? $res['nickname']);
|
||||
if(empty($username)) {
|
||||
return;
|
||||
}
|
||||
|
|
1247
package-lock.json
generated
1247
package-lock.json
generated
File diff suppressed because it is too large
Load diff
26
package.json
26
package.json
|
@ -12,41 +12,41 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.18.1",
|
||||
"bootstrap": "^4.4.1",
|
||||
"bootstrap": "^4.5.0",
|
||||
"cross-env": "^5.2.1",
|
||||
"jquery": "^3.5.0",
|
||||
"lodash": ">=4.17.13",
|
||||
"popper.js": "^1.16.1",
|
||||
"resolve-url-loader": "^2.3.2",
|
||||
"sass": "^1.25.0",
|
||||
"sass": "^1.26.5",
|
||||
"sass-loader": "^7.3.1",
|
||||
"vue": "^2.6.11",
|
||||
"vue-masonry-css": "^1.0.3",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
},
|
||||
"dependencies": {
|
||||
"@trevoreyre/autocomplete-vue": "^2.1.0",
|
||||
"bootstrap-vue": "^2.4.1",
|
||||
"@trevoreyre/autocomplete-vue": "^2.1.1",
|
||||
"bootstrap-vue": "^2.14.0",
|
||||
"filesize": "^3.6.1",
|
||||
"howler": "^2.1.3",
|
||||
"howler": "^2.2.0",
|
||||
"infinite-scroll": "^3.0.6",
|
||||
"laravel-echo": "^1.6.1",
|
||||
"laravel-echo": "^1.8.0",
|
||||
"laravel-mix": "^4.1.4",
|
||||
"node-sass": "^4.13.1",
|
||||
"node-sass": "^4.14.1",
|
||||
"promise-polyfill": "8.1.0",
|
||||
"quill": "^1.3.7",
|
||||
"readmore-js": "^2.2.1",
|
||||
"sweetalert": "^2.1.2",
|
||||
"tributejs": "^4.1.1",
|
||||
"tributejs": "^4.1.3",
|
||||
"twitter-text": "^2.0.5",
|
||||
"vue-carousel": "^0.18.0",
|
||||
"vue-content-loader": "^0.2.2",
|
||||
"vue-cropperjs": "^4.0.1",
|
||||
"vue-infinite-loading": "^2.4.4",
|
||||
"vue-loading-overlay": "^3.2.0",
|
||||
"vue-content-loader": "^0.2.3",
|
||||
"vue-cropperjs": "^4.1.0",
|
||||
"vue-infinite-loading": "^2.4.5",
|
||||
"vue-loading-overlay": "^3.3.2",
|
||||
"vue-timeago": "^5.1.2",
|
||||
"vue-tribute": "^1.0.4",
|
||||
"zuck.js": "^1.5.6"
|
||||
"zuck.js": "^1.6.0"
|
||||
},
|
||||
"collective": {
|
||||
"type": "opencollective",
|
||||
|
|
BIN
public/css/app.css
vendored
BIN
public/css/app.css
vendored
Binary file not shown.
BIN
public/css/appdark.css
vendored
BIN
public/css/appdark.css
vendored
Binary file not shown.
BIN
public/css/landing.css
vendored
BIN
public/css/landing.css
vendored
Binary file not shown.
BIN
public/js/ace.js
vendored
BIN
public/js/ace.js
vendored
Binary file not shown.
BIN
public/js/app.js
vendored
BIN
public/js/app.js
vendored
Binary file not shown.
BIN
public/js/components.js
vendored
BIN
public/js/components.js
vendored
Binary file not shown.
BIN
public/js/compose.js
vendored
BIN
public/js/compose.js
vendored
Binary file not shown.
BIN
public/js/profile-directory.js
vendored
BIN
public/js/profile-directory.js
vendored
Binary file not shown.
BIN
public/js/profile.js
vendored
BIN
public/js/profile.js
vendored
Binary file not shown.
BIN
public/js/quill.js
vendored
BIN
public/js/quill.js
vendored
Binary file not shown.
BIN
public/js/rempos.js
vendored
BIN
public/js/rempos.js
vendored
Binary file not shown.
BIN
public/js/status.js
vendored
BIN
public/js/status.js
vendored
Binary file not shown.
BIN
public/js/story-compose.js
vendored
BIN
public/js/story-compose.js
vendored
Binary file not shown.
BIN
public/js/timeline.js
vendored
BIN
public/js/timeline.js
vendored
Binary file not shown.
BIN
public/js/vendor.js
vendored
BIN
public/js/vendor.js
vendored
Binary file not shown.
Binary file not shown.
2
resources/assets/js/app.js
vendored
2
resources/assets/js/app.js
vendored
|
@ -73,7 +73,7 @@ window.App.util = {
|
|||
timeAgo: (function(ts) {
|
||||
let date = Date.parse(ts);
|
||||
let seconds = Math.floor((new Date() - date) / 1000);
|
||||
let interval = Math.floor(seconds / 31536000);
|
||||
let interval = Math.floor(seconds / 63072000);
|
||||
if (interval >= 1) {
|
||||
return interval + "y";
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div>
|
||||
<input type="file" id="pf-dz" name="media" class="w-100 h-100 d-none file-input" draggable="true" v-bind:accept="config.uploader.media_types" multiple="">
|
||||
<input type="file" id="pf-dz" name="media" class="w-100 h-100 d-none file-input" v-bind:accept="config.uploader.media_types">
|
||||
<div class="timeline">
|
||||
<div v-if="uploading">
|
||||
<div class="card status-card card-md-rounded-0 w-100 h-100 bg-light py-3" style="border-bottom: 1px solid #f1f1f1">
|
||||
|
@ -616,6 +616,7 @@ export default {
|
|||
mediaWatcher() {
|
||||
let self = this;
|
||||
$(document).on('change', '#pf-dz', function(e) {
|
||||
e.preventDefault();
|
||||
self.mediaUpload();
|
||||
});
|
||||
},
|
||||
|
|
|
@ -16,9 +16,6 @@
|
|||
<span>
|
||||
<span>{{prettyCount(profile.statuses_count)}}</span> POSTS
|
||||
</span>
|
||||
<span>
|
||||
<span>{{postsPerDay(profile)}}</span> POSTS/DAY
|
||||
</span>
|
||||
<span>
|
||||
<span>{{prettyCount(profile.followers_count)}}</span> FOLLOWERS
|
||||
</span>
|
||||
|
@ -105,19 +102,6 @@
|
|||
|
||||
thumbUrl(p) {
|
||||
return p.media_attachments[0].url;
|
||||
},
|
||||
|
||||
postsPerDay(profile) {
|
||||
let created = profile.created_at;
|
||||
let now = Date.now();
|
||||
let diff = Math.abs(created, now)
|
||||
let day = 1000 * 60 * 60 * 24;
|
||||
let days = Math.round(diff / day);
|
||||
|
||||
let statuses = profile.statuses_count;
|
||||
|
||||
let perDay = this.prettyCount(Math.floor(statuses / days));
|
||||
return perDay;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="form-group row">
|
||||
|
||||
<div class="col-md-12">
|
||||
<input id="code" type="text" class="form-control{{ $errors->has('code') ? ' is-invalid' : '' }}" name="code" placeholder="{{__('Two-Factor Authentication Code')}}" required autocomplete="off" autofocus="" inputmode="numeric" minlength="6" maxlength="6">
|
||||
<input id="code" type="text" class="form-control{{ $errors->has('code') ? ' is-invalid' : '' }}" name="code" placeholder="{{__('Two-Factor Authentication Code')}}" required autocomplete="off" autofocus="" inputmode="numeric" minlength="6">
|
||||
|
||||
@if ($errors->has('code'))
|
||||
<span class="invalid-feedback">
|
||||
|
|
|
@ -60,6 +60,8 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
|
|||
Route::get('statuses/{id}/favourited_by', 'Api\ApiV1Controller@statusFavouritedBy')->middleware($middleware);
|
||||
Route::post('statuses/{id}/reblog', 'Api\ApiV1Controller@statusShare')->middleware($middleware);
|
||||
Route::post('statuses/{id}/unreblog', 'Api\ApiV1Controller@statusUnshare')->middleware($middleware);
|
||||
Route::post('statuses/{id}/bookmark', 'Api\ApiV1Controller@bookmarkStatus')->middleware($middleware);
|
||||
Route::post('statuses/{id}/unbookmark', 'Api\ApiV1Controller@unbookmarkStatus')->middleware($middleware);
|
||||
Route::delete('statuses/{id}', 'Api\ApiV1Controller@statusDelete')->middleware($middleware);
|
||||
Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById')->middleware($middleware);
|
||||
Route::post('statuses', 'Api\ApiV1Controller@statusCreate')->middleware($middleware)->middleware('throttle:maxPostsPerHour,60')->middleware('throttle:maxPostsPerDay,1440');
|
||||
|
|
|
@ -428,5 +428,6 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::get('p/{username}/{id}.json', 'StatusController@showObject');
|
||||
Route::get('p/{username}/{id}', 'StatusController@show');
|
||||
Route::get('{username}/embed', 'ProfileController@embed');
|
||||
Route::get('@{username}', 'SiteController@legacyProfileRedirect');
|
||||
Route::get('{username}', 'ProfileController@show');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue