mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-14 10:34:31 +00:00
commit
08dd3bf66a
5 changed files with 120 additions and 32 deletions
|
@ -87,6 +87,8 @@
|
||||||
- Updated LikeService, fix likedBy method. ([a5e64da6](https://github.com/pixelfed/pixelfed/commit/a5e64da6))
|
- Updated LikeService, fix likedBy method. ([a5e64da6](https://github.com/pixelfed/pixelfed/commit/a5e64da6))
|
||||||
- Updated PublicApiController, increase public timeline to 6 months from 3. ([8a736432](https://github.com/pixelfed/pixelfed/commit/8a736432))
|
- Updated PublicApiController, increase public timeline to 6 months from 3. ([8a736432](https://github.com/pixelfed/pixelfed/commit/8a736432))
|
||||||
- Updated LikeService, show like count to status owner. ([4408e2ef](https://github.com/pixelfed/pixelfed/commit/4408e2ef))
|
- Updated LikeService, show like count to status owner. ([4408e2ef](https://github.com/pixelfed/pixelfed/commit/4408e2ef))
|
||||||
|
- Updated admin settings, add rules. ([a4efbb75](https://github.com/pixelfed/pixelfed/commit/a4efbb75))
|
||||||
|
- Updated LikeService, fix authentication bug. ([c9abd70e](https://github.com/pixelfed/pixelfed/commit/c9abd70e))
|
||||||
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
- ([](https://github.com/pixelfed/pixelfed/commit/))
|
||||||
|
|
||||||
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)
|
## [v0.10.10 (2021-01-28)](https://github.com/pixelfed/pixelfed/compare/v0.10.9...v0.10.10)
|
||||||
|
|
|
@ -19,6 +19,7 @@ trait AdminSettingsController
|
||||||
$short_description = ConfigCacheService::get('app.short_description');
|
$short_description = ConfigCacheService::get('app.short_description');
|
||||||
$description = ConfigCacheService::get('app.description');
|
$description = ConfigCacheService::get('app.description');
|
||||||
$types = explode(',', ConfigCacheService::get('pixelfed.media_types'));
|
$types = explode(',', ConfigCacheService::get('pixelfed.media_types'));
|
||||||
|
$rules = ConfigCacheService::get('app.rules') ? json_decode(ConfigCacheService::get('app.rules'), true) : null;
|
||||||
$jpeg = in_array('image/jpg', $types) ? true : in_array('image/jpeg', $types);
|
$jpeg = in_array('image/jpg', $types) ? true : in_array('image/jpeg', $types);
|
||||||
$png = in_array('image/png', $types);
|
$png = in_array('image/png', $types);
|
||||||
$gif = in_array('image/gif', $types);
|
$gif = in_array('image/gif', $types);
|
||||||
|
@ -31,7 +32,8 @@ trait AdminSettingsController
|
||||||
'jpeg',
|
'jpeg',
|
||||||
'png',
|
'png',
|
||||||
'gif',
|
'gif',
|
||||||
'mp4'
|
'mp4',
|
||||||
|
'rules'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,6 +52,19 @@ trait AdminSettingsController
|
||||||
'type_mp4' => 'nullable',
|
'type_mp4' => 'nullable',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if($request->filled('rule_delete')) {
|
||||||
|
$index = (int) $request->input('rule_delete');
|
||||||
|
$rules = ConfigCacheService::get('app.rules');
|
||||||
|
$json = json_decode($rules, true);
|
||||||
|
if(!$rules || empty($json)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unset($json[$index]);
|
||||||
|
$json = json_encode(array_values($json));
|
||||||
|
ConfigCacheService::put('app.rules', $json);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
$media_types = explode(',', config_cache('pixelfed.media_types'));
|
$media_types = explode(',', config_cache('pixelfed.media_types'));
|
||||||
$media_types_original = $media_types;
|
$media_types_original = $media_types;
|
||||||
|
|
||||||
|
@ -115,6 +130,18 @@ trait AdminSettingsController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($request->filled('new_rule')) {
|
||||||
|
$rules = ConfigCacheService::get('app.rules');
|
||||||
|
$val = $request->input('new_rule');
|
||||||
|
if(!$rules) {
|
||||||
|
ConfigCacheService::put('app.rules', json_encode([$val]));
|
||||||
|
} else {
|
||||||
|
$json = json_decode($rules, true);
|
||||||
|
$json[] = $val;
|
||||||
|
ConfigCacheService::put('app.rules', json_encode(array_values($json)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Cache::forget('api:site:configuration:_v0.2');
|
Cache::forget('api:site:configuration:_v0.2');
|
||||||
|
|
||||||
return redirect('/i/admin/settings');
|
return redirect('/i/admin/settings');
|
||||||
|
|
|
@ -957,37 +957,49 @@ class ApiV1Controller extends Controller
|
||||||
*/
|
*/
|
||||||
public function instance(Request $request)
|
public function instance(Request $request)
|
||||||
{
|
{
|
||||||
$res = [
|
$res = Cache::remember('api:v1:instance-data', now()->addMinutes(15), function () {
|
||||||
'approval_required' => false,
|
$rules = config_cache('app.rules') ? collect(json_decode(config_cache('app.rules'), true))
|
||||||
'contact_account' => null,
|
->map(function($rule, $key) {
|
||||||
'description' => config_cache('app.description'),
|
$id = $key + 1;
|
||||||
'email' => config('instance.email'),
|
return [
|
||||||
'invites_enabled' => false,
|
'id' => "{$id}",
|
||||||
'rules' => [],
|
'text' => $rule
|
||||||
'short_description' => 'Pixelfed - Photo sharing for everyone',
|
];
|
||||||
'languages' => ['en'],
|
})
|
||||||
'max_toot_chars' => (int) config('pixelfed.max_caption_length'),
|
->toArray() : [];
|
||||||
'registrations' => config_cache('pixelfed.open_registration'),
|
$res = [
|
||||||
'stats' => [
|
'approval_required' => false,
|
||||||
'user_count' => 0,
|
'contact_account' => null,
|
||||||
'status_count' => 0,
|
'description' => config_cache('app.description'),
|
||||||
'domain_count' => 0
|
'email' => config('instance.email'),
|
||||||
],
|
'invites_enabled' => false,
|
||||||
'thumbnail' => config('app.url') . '/img/pixelfed-icon-color.png',
|
'rules' => $rules,
|
||||||
'title' => config_cache('app.name'),
|
'short_description' => 'Pixelfed - Photo sharing for everyone',
|
||||||
'uri' => config('pixelfed.domain.app'),
|
'languages' => ['en'],
|
||||||
'urls' => [],
|
'max_toot_chars' => (int) config('pixelfed.max_caption_length'),
|
||||||
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')',
|
'registrations' => config_cache('pixelfed.open_registration'),
|
||||||
'environment' => [
|
'stats' => [
|
||||||
'max_photo_size' => (int) config_cache('pixelfed.max_photo_size'),
|
'user_count' => 0,
|
||||||
'max_avatar_size' => (int) config('pixelfed.max_avatar_size'),
|
'status_count' => 0,
|
||||||
'max_caption_length' => (int) config('pixelfed.max_caption_length'),
|
'domain_count' => 0
|
||||||
'max_bio_length' => (int) config('pixelfed.max_bio_length'),
|
],
|
||||||
'max_album_length' => (int) config_cache('pixelfed.max_album_length'),
|
'thumbnail' => config('app.url') . '/img/pixelfed-icon-color.png',
|
||||||
'mobile_apis' => config_cache('pixelfed.oauth_enabled')
|
'title' => config_cache('app.name'),
|
||||||
|
'uri' => config('pixelfed.domain.app'),
|
||||||
|
'urls' => [],
|
||||||
|
'version' => '2.7.2 (compatible; Pixelfed ' . config('pixelfed.version') . ')',
|
||||||
|
'environment' => [
|
||||||
|
'max_photo_size' => (int) config_cache('pixelfed.max_photo_size'),
|
||||||
|
'max_avatar_size' => (int) config('pixelfed.max_avatar_size'),
|
||||||
|
'max_caption_length' => (int) config('pixelfed.max_caption_length'),
|
||||||
|
'max_bio_length' => (int) config('pixelfed.max_bio_length'),
|
||||||
|
'max_album_length' => (int) config_cache('pixelfed.max_album_length'),
|
||||||
|
'mobile_apis' => config_cache('pixelfed.oauth_enabled')
|
||||||
|
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
return $res;
|
||||||
|
});
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ class LikeService {
|
||||||
'others' => $status->likes_count >= 5,
|
'others' => $status->likes_count >= 5,
|
||||||
];
|
];
|
||||||
|
|
||||||
if(request()->user()->profile_id == $status->profile_id) {
|
if(request()->user() && request()->user()->profile_id == $status->profile_id) {
|
||||||
$res['total_count'] = $status->likes_count;
|
$res['total_count'] = $status->likes_count;
|
||||||
$res['total_count_pretty'] = number_format($res['total_count']);
|
$res['total_count_pretty'] = number_format($res['total_count']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
<li class="nav-item border-none">
|
<li class="nav-item border-none">
|
||||||
<a class="nav-link font-weight-bold px-4" id="users-tab" data-toggle="tab" href="#users" role="tab" aria-controls="users">Users</a>
|
<a class="nav-link font-weight-bold px-4" id="users-tab" data-toggle="tab" href="#users" role="tab" aria-controls="users">Users</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="nav-item border-none">
|
||||||
|
<a class="nav-link font-weight-bold px-4" id="rules-tab" data-toggle="tab" href="#rules" role="tab" aria-controls="rules">Rules</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link font-weight-bold px-4" id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced">Advanced</a>
|
<a class="nav-link font-weight-bold px-4" id="advanced-tab" data-toggle="tab" href="#advanced" role="tab" aria-controls="advanced">Advanced</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -151,6 +154,35 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="tab-pane" id="rules" role="tabpanel" aria-labelledby="rules-tab">
|
||||||
|
<div class="border-top">
|
||||||
|
<p class="lead mt-3 py-3 text-center">Add rules that explain what is acceptable use.</p>
|
||||||
|
</div>
|
||||||
|
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||||
|
<p class="font-weight-bold text-muted">Active Rules</p>
|
||||||
|
<ol class="font-weight-bold">
|
||||||
|
@if($rules)
|
||||||
|
@foreach($rules as $rule)
|
||||||
|
<li class="mb-4">
|
||||||
|
<p class="mb-0">
|
||||||
|
{{$rule}}
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<button type="button" class="btn btn-outline-danger btn-sm py-0 rule-delete" data-index="{{$loop->index}}">Delete</button>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div class="form-group mb-0">
|
||||||
|
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||||
|
<label class="font-weight-bold text-muted">Add Rule</label>
|
||||||
|
<input class="form-control" name="new_rule" placeholder="Add a new rule, we recommend being descriptive but keeping it short"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="tab-pane" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
|
<div class="tab-pane" id="advanced" role="tabpanel" aria-labelledby="advanced-tab">
|
||||||
<div class="form-group mb-0">
|
<div class="form-group mb-0">
|
||||||
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
<div class="ml-n4 mr-n2 p-3 bg-light border-top border-bottom">
|
||||||
|
@ -181,3 +213,18 @@
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('.rule-delete').on('click', function(e) {
|
||||||
|
if(window.confirm('Are you sure you want to delete this rule?')) {
|
||||||
|
let idx = e.target.dataset.index;
|
||||||
|
axios.post(window.location.href, {
|
||||||
|
'rule_delete': idx
|
||||||
|
}).then(res => {
|
||||||
|
$('.rule-delete[data-index="'+idx+'"]').parents().eq(1).remove();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
Loading…
Reference in a new issue