mirror of https://github.com/MarceauKa/shaark.git
✨ Chests are now encrypted in database 🐛 Chest Export with non-encrypted values 🐛 Settings will not merge shaarli config anymore 📝 Typos in readme
This commit is contained in:
parent
af9141c306
commit
fd639df178
|
@ -14,9 +14,6 @@ class Chest extends Model
|
|||
'title',
|
||||
'content',
|
||||
];
|
||||
protected $casts = [
|
||||
'content' => 'json',
|
||||
];
|
||||
|
||||
public function getCreatedAtFormatedAttribute(): string
|
||||
{
|
||||
|
@ -38,13 +35,35 @@ class Chest extends Model
|
|||
return $query->where('id', app('hashid')->decode($hash));
|
||||
}
|
||||
|
||||
public function getContentAttribute($value)
|
||||
{
|
||||
try {
|
||||
$content = decrypt($value, false);
|
||||
} catch (\Exception $e) {
|
||||
$content = $value;
|
||||
}
|
||||
|
||||
return json_decode($content);
|
||||
}
|
||||
|
||||
public function setContentAttribute($value)
|
||||
{
|
||||
try {
|
||||
$content = encrypt(json_encode($value), false);
|
||||
} catch (\Exception $e) {
|
||||
$content = json_encode($value);
|
||||
}
|
||||
|
||||
$this->attributes['content'] = $content;
|
||||
}
|
||||
|
||||
public function toSearchableArray()
|
||||
{
|
||||
return [
|
||||
'title' => $this->title,
|
||||
'content' => collect($this->content)
|
||||
->reject(function ($item) {
|
||||
return false === in_array($item['type'], ['url', 'text']);
|
||||
return false === in_array($item->type, ['url', 'text']);
|
||||
})
|
||||
->pluck('value')
|
||||
->implode("\n"),
|
||||
|
|
|
@ -43,13 +43,13 @@ class ChestsExport implements FromCollection, WithMapping, WithHeadings
|
|||
$output = '';
|
||||
|
||||
foreach ($content as $line) {
|
||||
if ($line['type'] === 'code') {
|
||||
$output .= $line['name'] . " :\n" . $line['value'] . "\n";
|
||||
if ($line->type === 'code') {
|
||||
$output .= $line->name . " :\n" . $line->value . "\n";
|
||||
} else {
|
||||
$output .= $line['name'] . " : " . $line['value'] . "\n";
|
||||
$output .= $line->name . " : " . $line->value . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,6 @@ class Shaarli
|
|||
{
|
||||
$this->app = $app;
|
||||
$this->settings = Valuestore::make(storage_path('settings.json'));
|
||||
|
||||
foreach ($this->app['config']->get('shaarli') as $key => $item) {
|
||||
if ($this->settings->has($key) === false) {
|
||||
$this->settings->put($key, $item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function authorizeFromRequest(Request $request): bool
|
||||
|
|
12
changelog.md
12
changelog.md
|
@ -1,3 +1,15 @@
|
|||
# Unreleased
|
||||
|
||||
## Changed
|
||||
|
||||
- Chests are now encrypted in database
|
||||
|
||||
## Fixed
|
||||
|
||||
- Settings will not merge shaarli config anymore
|
||||
- Chest Export with non-encrypted values
|
||||
- Typos in readme
|
||||
|
||||
# 1.2.8
|
||||
|
||||
## Changed
|
||||
|
|
16
readme.md
16
readme.md
|
@ -20,6 +20,7 @@ but built with [Laravel](https://github.com/laravel/laravel) and [Vue.js](https:
|
|||
- [Security](#security)
|
||||
- [Update](#update)
|
||||
- [Going live](#going-live)
|
||||
- [Artisan commands](#artisan-commands)
|
||||
- [Tests](#tests)
|
||||
- [Licence](#licence)
|
||||
|
||||
|
@ -85,7 +86,7 @@ If you don't want your content being publicy accessible, you can update this pre
|
|||
You're able to active 2-FA (2 factors authentication). By default 2-FA is disabled but you can update it from your app settings.
|
||||
Code length and code expiration are also configurable. **Test if you application can send emails before enabling this feature**.
|
||||
|
||||
### Auths monitoring
|
||||
### Auth monitoring
|
||||
|
||||
Shaarli logs all successful and failed auths with their associated devices.
|
||||
|
||||
|
@ -99,9 +100,7 @@ git reset --hard
|
|||
git pull origin master
|
||||
composer install --no-dev -o
|
||||
php artisan migrate --force -n
|
||||
php artisan cache:clear
|
||||
php artisan config:cache
|
||||
php artisan route:cache
|
||||
php artisan optimize
|
||||
php artisan view:clear
|
||||
php artisan queue:restart # if you're using queues
|
||||
php artisan up
|
||||
|
@ -131,11 +130,14 @@ MAIL_FROM_ADDRESS={your_email}
|
|||
|
||||
**Artisan routines**
|
||||
```
|
||||
php artisan cache:clear
|
||||
php artisan route:cache
|
||||
php artisan config:cache
|
||||
php artisan optimize
|
||||
php artisan view:clear
|
||||
```
|
||||
|
||||
## Artisan commands
|
||||
|
||||
__TO DO__
|
||||
|
||||
## Tests
|
||||
|
||||
1. Be sure to have a testing database with `touch database/testing.sqlite` and have composer `require-dev` dependencies installer.
|
||||
|
|
Loading…
Reference in New Issue