mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 22:41:27 +00:00
Merge pull request #1387 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
693ad8fda9
30 changed files with 655 additions and 318 deletions
|
@ -38,7 +38,7 @@ class SearchController extends Controller
|
|||
$tokens = [];
|
||||
if(Helpers::validateUrl($tag) != false && config('federation.activitypub.enabled') == true && config('federation.activitypub.remoteFollow') == true) {
|
||||
$remote = Helpers::fetchFromUrl($tag);
|
||||
if(isset($remote['type']) && in_array($remote['type'], ['Create', 'Person']) == true) {
|
||||
if(isset($remote['type']) && in_array($remote['type'], ['Note', 'Person']) == true) {
|
||||
$type = $remote['type'];
|
||||
if($type == 'Person') {
|
||||
$item = Helpers::profileFirstOrNew($tag);
|
||||
|
@ -55,7 +55,7 @@ class SearchController extends Controller
|
|||
'thumb' => $item->avatarUrl()
|
||||
]
|
||||
]];
|
||||
} else if ($type == 'Create') {
|
||||
} else if ($type == 'Note') {
|
||||
$item = Helpers::statusFirstOrFetch($tag, false);
|
||||
$tokens['posts'] = [[
|
||||
'count' => 0,
|
||||
|
|
24
app/Http/Controllers/Settings/RelationshipSettings.php
Normal file
24
app/Http/Controllers/Settings/RelationshipSettings.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Settings;
|
||||
|
||||
use App\AccountLog;
|
||||
use App\EmailVerification;
|
||||
use App\Instance;
|
||||
use App\Media;
|
||||
use App\Profile;
|
||||
use App\User;
|
||||
use App\UserFilter;
|
||||
use App\Util\Lexer\PrettyNumber;
|
||||
use Auth, Cache, DB;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
trait RelationshipSettings
|
||||
{
|
||||
|
||||
public function relationshipsHome()
|
||||
{
|
||||
return view('settings.relationships.home');
|
||||
}
|
||||
|
||||
}
|
67
app/Services/PublicTimelineService.php
Normal file
67
app/Services/PublicTimelineService.php
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Redis;
|
||||
use App\{
|
||||
Profile,
|
||||
Status,
|
||||
UserFilter
|
||||
};
|
||||
|
||||
class PublicTimelineService {
|
||||
|
||||
const CACHE_KEY = 'pf:services:timeline:public';
|
||||
|
||||
public static function get($start = 0, $stop = 10)
|
||||
{
|
||||
if($stop > 100) {
|
||||
$stop = 100;
|
||||
}
|
||||
$tl = [];
|
||||
$keys = Redis::zrevrange(self::CACHE_KEY, $start, $stop);
|
||||
foreach($keys as $key) {
|
||||
array_push($tl, StatusService::get($key));
|
||||
}
|
||||
return $tl;
|
||||
}
|
||||
|
||||
public static function add($val)
|
||||
{
|
||||
return Redis::zadd(self::CACHE_KEY, 1, $val);
|
||||
}
|
||||
|
||||
public static function rem($val)
|
||||
{
|
||||
return Redis::zrem(self::CACHE_KEY, $val);
|
||||
}
|
||||
|
||||
public static function del($val)
|
||||
{
|
||||
return self::rem($val);
|
||||
}
|
||||
|
||||
public static function count()
|
||||
{
|
||||
return Redis::zcount(self::CACHE_KEY, '-inf', '+inf');
|
||||
}
|
||||
|
||||
public static function warmCache($force = false, $limit = 100)
|
||||
{
|
||||
if(self::count() == 0 || $force == true) {
|
||||
$ids = Status::whereNull('uri')
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->whereIn('type', ['photo', 'photo:album'])
|
||||
->whereScope('public')
|
||||
->latest()
|
||||
->limit($limit)
|
||||
->pluck('id');
|
||||
foreach($ids as $id) {
|
||||
self::add($id);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
46
app/Services/StatusService.php
Normal file
46
app/Services/StatusService.php
Normal file
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Redis;
|
||||
use App\Status;
|
||||
use App\Transformer\Api\StatusStatelessTransformer;
|
||||
use League\Fractal;
|
||||
use League\Fractal\Serializer\ArraySerializer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
|
||||
class StatusService {
|
||||
|
||||
const CACHE_KEY = 'pf:services:status:';
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Redis::get(self::CACHE_KEY . $id) ?? self::coldGet($id);
|
||||
}
|
||||
|
||||
public static function coldGet($id)
|
||||
{
|
||||
$status = Status::findOrFail($id);
|
||||
$fractal = new Fractal\Manager();
|
||||
$fractal->setSerializer(new ArraySerializer());
|
||||
$resource = new Fractal\Resource\Item($status, new StatusStatelessTransformer());
|
||||
$res = $fractal->createData($resource)->toJson();
|
||||
self::set($id, $res);
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function set($key, $val)
|
||||
{
|
||||
return Redis::set(self::CACHE_KEY . $key, $val);
|
||||
}
|
||||
|
||||
public static function del($key)
|
||||
{
|
||||
return Redis::del(self::CACHE_KEY . $key);
|
||||
}
|
||||
|
||||
public static function rem($key)
|
||||
{
|
||||
return self::del($key);
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@ class StatusTransformer extends Fractal\TransformerAbstract
|
|||
|
||||
public function includeMediaAttachments(Status $status)
|
||||
{
|
||||
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addMinutes(3), function() use($status) {
|
||||
return Cache::remember('status:transformer:media:attachments:'.$status->id, now()->addDays(14), function() use($status) {
|
||||
if(in_array($status->type, ['photo', 'video', 'photo:album', 'loop'])) {
|
||||
$media = $status->media()->orderBy('order')->get();
|
||||
return $this->collection($media, new MediaTransformer());
|
||||
|
|
|
@ -17,7 +17,7 @@ return [
|
|||
'inbox' => env('AP_INBOX', true),
|
||||
'sharedInbox' => env('AP_SHAREDINBOX', false),
|
||||
|
||||
'remoteFollow' => false,
|
||||
'remoteFollow' => env('AP_REMOTEFOLLOW', false),
|
||||
|
||||
'delivery' => [
|
||||
'timeout' => env('ACTIVITYPUB_DELIVERY_TIMEOUT', 2.0),
|
||||
|
|
768
package-lock.json
generated
768
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -11,26 +11,28 @@
|
|||
"postinstall": "opencollective-postinstall"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^0.18",
|
||||
"axios": "^0.18.1",
|
||||
"bootstrap": ">=4.3.1",
|
||||
"cross-env": "^5.2.0",
|
||||
"jquery": "^3.4.1",
|
||||
"lodash": "^4.17.11",
|
||||
"popper.js": "^1.15.0",
|
||||
"purify-css": "^1.2.5",
|
||||
"purifycss-webpack": "^0.7.0",
|
||||
"resolve-url-loader": "^2.3.2",
|
||||
"sass": "^1.19.0",
|
||||
"sass": "^1.21.0",
|
||||
"sass-loader": "^7.1.0",
|
||||
"vue": "^2.6.10",
|
||||
"vue-template-compiler": "^2.6.10"
|
||||
},
|
||||
"dependencies": {
|
||||
"bootstrap-vue": "^2.0.0-rc.19",
|
||||
"bootstrap-vue": "^2.0.0-rc.22",
|
||||
"emoji-mart-vue": "^2.6.6",
|
||||
"filesize": "^3.6.1",
|
||||
"howler": "^2.1.2",
|
||||
"infinite-scroll": "^3.0.6",
|
||||
"laravel-echo": "^1.5.3",
|
||||
"laravel-mix": "^4.0.15",
|
||||
"laravel-mix": "^4.0.16",
|
||||
"node-sass": "^4.12.0",
|
||||
"opencollective": "^1.0.3",
|
||||
"opencollective-postinstall": "^2.0.2",
|
||||
|
|
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/activity.js
vendored
BIN
public/js/activity.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/developers.js
vendored
BIN
public/js/developers.js
vendored
Binary file not shown.
BIN
public/js/discover.js
vendored
BIN
public/js/discover.js
vendored
Binary file not shown.
BIN
public/js/loops.js
vendored
BIN
public/js/loops.js
vendored
Binary file not shown.
BIN
public/js/manifest.js
vendored
Normal file
BIN
public/js/manifest.js
vendored
Normal file
Binary file not shown.
BIN
public/js/profile.js
vendored
BIN
public/js/profile.js
vendored
Binary file not shown.
BIN
public/js/search.js
vendored
BIN
public/js/search.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/timeline.js
vendored
BIN
public/js/timeline.js
vendored
Binary file not shown.
BIN
public/js/vendor.js
vendored
Normal file
BIN
public/js/vendor.js
vendored
Normal file
Binary file not shown.
Binary file not shown.
|
@ -8,13 +8,13 @@
|
|||
<hr>
|
||||
|
||||
<table class="table">
|
||||
<thead class="thead-dark">
|
||||
<thead class="bg-light">
|
||||
<tr>
|
||||
<th scope="col">#</th>
|
||||
<th scope="col">Username</th>
|
||||
<th scope="col">Likes</th>
|
||||
<th scope="col">Storage</th>
|
||||
<th scope="col">Created</th>
|
||||
<th scope="col" class="border-0 text-dark">#</th>
|
||||
<th scope="col" class="border-0 text-dark">Username</th>
|
||||
<th scope="col" class="border-0 text-dark">Likes</th>
|
||||
<th scope="col" class="border-0 text-dark">Storage</th>
|
||||
<th scope="col" class="border-0 text-dark">Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
@yield('content')
|
||||
</main>
|
||||
@include('layouts.partial.footer')
|
||||
<script type="text/javascript" src="{{ mix('js/manifest.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/vendor.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
|
||||
@stack('scripts')
|
||||
</body>
|
||||
|
|
|
@ -47,6 +47,8 @@
|
|||
@endif
|
||||
</main>
|
||||
@include('layouts.partial.footer')
|
||||
<script type="text/javascript" src="{{ mix('js/manifest.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/vendor.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/components.js') }}"></script>
|
||||
@stack('scripts')
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
<main id="content">
|
||||
@yield('content')
|
||||
</main>
|
||||
<script type="text/javascript" src="{{ mix('js/manifest.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/vendor.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/app.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ mix('js/components.js') }}"></script>
|
||||
@stack('scripts')
|
||||
|
|
32
webpack.mix.js
vendored
32
webpack.mix.js
vendored
|
@ -1,5 +1,9 @@
|
|||
let mix = require('laravel-mix');
|
||||
|
||||
mix.options({
|
||||
purifyCss: true,
|
||||
});
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Mix Asset Management
|
||||
|
@ -11,6 +15,16 @@ let mix = require('laravel-mix');
|
|||
|
|
||||
*/
|
||||
|
||||
mix.sass('resources/assets/sass/app.scss', 'public/css', {
|
||||
implementation: require('node-sass')
|
||||
})
|
||||
.sass('resources/assets/sass/appdark.scss', 'public/css', {
|
||||
implementation: require('node-sass')
|
||||
})
|
||||
.sass('resources/assets/sass/landing.scss', 'public/css', {
|
||||
implementation: require('node-sass')
|
||||
}).version();
|
||||
|
||||
mix.js('resources/assets/js/app.js', 'public/js')
|
||||
.js('resources/assets/js/activity.js', 'public/js')
|
||||
.js('resources/assets/js/components.js', 'public/js')
|
||||
|
@ -43,13 +57,13 @@ mix.js('resources/assets/js/app.js', 'public/js')
|
|||
// Loops Component
|
||||
.js('resources/assets/js/loops.js', 'public/js')
|
||||
|
||||
.sass('resources/assets/sass/app.scss', 'public/css', {
|
||||
implementation: require('node-sass')
|
||||
})
|
||||
.sass('resources/assets/sass/appdark.scss', 'public/css', {
|
||||
implementation: require('node-sass')
|
||||
})
|
||||
.sass('resources/assets/sass/landing.scss', 'public/css', {
|
||||
implementation: require('node-sass')
|
||||
})
|
||||
.extract([
|
||||
'lodash',
|
||||
'popper.js',
|
||||
'jquery',
|
||||
'axios',
|
||||
'bootstrap',
|
||||
'vue',
|
||||
'readmore-js'
|
||||
])
|
||||
.version();
|
||||
|
|
Loading…
Reference in a new issue