Skip to content

Commit

Permalink
Release (#1)
Browse files Browse the repository at this point in the history
* Started draw.io integration

* Updated pull-request info to be clearer

Also updated dev version

* Adds code to allow deletion of users via cmd line.

Fixes BookStackApp#579

Command:

php artisan bookstack:delete-users

Signed-off-by: Abijeet <[email protected]>

* Adds button to allow users to toggle the book view via the books list page.

Closes BookStackApp#613

Signed-off-by: Abijeet <[email protected]>

* Adds test cases and fixes an issue with the permission checking.

Signed-off-by: Abijeet <[email protected]>

* Enabled session in 404 responses

Fixes #634

* Adds font-size to ol to ensure that they are uniform.

Fixes BookStackApp#643

Signed-off-by: Abijeet <[email protected]>

* Standardised admin role check

* Updated book view change to PATCH + other amends

Moved toggle to right of header bar and added unique text and icon for
each view type.

Removed old profile setting to keep things clean.

* Enabled system-storage of drawings made via draw.io

* Fixed broken table/ol/ul page includes

Fixes BookStackApp#640

* Fixed failing book view test

Also ensured setting system localcache is cleared correctly

* Checks the target and the source book before performing the sort.

Signed-off-by: Abijeet <[email protected]>

* Changed the sort view to only show books to which we have an update permission.

Signed-off-by: Abijeet <[email protected]>

* Adds test case for sorting permissions.

Signed-off-by: Abijeet <[email protected]>

* Added view override support

Relates to BookStackApp#652

* Refactored the code to first check for the permissions before sorting the book.

Signed-off-by: Abijeet <[email protected]>

* Adds overflow:auto to popup content to allow it to scroll in lower res.

Fixes BookStackApp#650

Signed-off-by: Abijeet <[email protected]>

* Added ability to secure images behind auth

Still in testing.
Adds STORAGE_TYPE=local_secure option for setting images to be behind
auth. Stores images alongside attachments in /storage/uploads/images.

* Refactored book sort using collections

* Added drawing update ability

* Added drawing icon and made drawio disablable

* Extracted draw.io functionality to own file

* Added drawio abilities to markdown editor

* Added Swedish translation

* Added Swedish locale to config

* Added drawing endpoint tests

Also refactored ImageTests away from BrowserKit
Also added image upload type validation.

* Fixed test failing from missing baseURL

Also updated image upload test to delete before upload to prevent failed
tests breaking subsequent tests.

* Actually fixed the BaseURL this time 🤦

* #630: Deleting user's profile pics on deleting of user account (BookStackApp#646)

* Issue-630: Fixed issue with deleting user profile pics when deleting a user.

* Issue #630: Deleting user's profile pics on deleting of user account

* Issue-630: Added test case for deleting user

* Updated user profile image delete to delete all uploads

Also moved test and made more comprehensive

* Adapted code insert area and language select for mobile

* Set /app PHP code to PSR-2 standard

Also adde draw.io to attribution list.

Closes BookStackApp#649

* Fixed validation issue on register post

Added test to cover and also cleaned up RegisterController comments.

Fixes #670

* Added command to add a new admin user

Closes BookStackApp#609

* Set markdown editor preview width to 100%

Fixes BookStackApp#658

* Add twitch socialite auth provider

* Update...

* add support for gitlab authentification

* add missing lock file

* Corrected the keys for okta auth

* Update services.php

* Update .env.example

* reduced icon size

* add missing icon, fix name conventions

* Update all.blade.php

* Made default books view configurable in .env

Under 'APP_VIEWS_BOOKS' key.
Closes BookStackApp#675

* Added simplified Chinese(zh-CN) language

* Added 'zh_CN' to app.locales

* Prevent image manager search from reloading page

Fixes BookStackApp#697

* Fixed code block wrapping on export

Now wraps instead of running off the page.

Fixed BookStackApp#676

* Updated grid view to use CSS grid and flexbox

Provides a cleaner height-matched design.
Closes BookStackApp#701

* Updated twitch SVG icon with vector SVG

* Fixed error when accessing non-authed attachment

Also updated attachment tests to use standard test-case.
Fixes BookStackApp#681

* Fixed text overflow in various views

Fixes BookStackApp#669

* Tweaked some comments

* Updated assets for release v0.20.0

* Made it possible to override icons via custom theme

* Started migration to SVG icons

* Finished migrated from icon-font to SVG

* Updated 'Spanish Argentina' translation.

* Added ability to configure email sender name

Added env variable MAIL_FROM_NAME to allow the email sender name to be
customised. Also added MAIL_FROM to .env.example

* Updated 'Spanish Argentina' translation.

* Add CACHE_PREFIX to the .env.example file

We had some problems with multiple BookStack instances using the same caching server. Perhaps it's a good idea to have this available in the `.env.example` file.

* fix markdown editor resizing with long strings

* typo in readme.md

* add missing polish translations for comments

* Update .env.example

* Attempted move to webpack again

* Reorganised dev-deps and updated moment

* Update Italian translation

* Fixes issue with the validation message not being translated.

Signed-off-by: Abijeet <[email protected]>

* Finished off intitial conversion to webpack

* Moved jQuery to use NPM and fixed some asset refs

* Added togglable script escaping to page content

Configurable via 'ALLOW_CONTENT_SCRIPTS' env variable.
Fixes BookStackApp#575

* Updated exports to use DejaVu font

Provides potentially better language font coverage.

* Markdown editor image paste sets cursor correctly

Now sets cursor to alt text rather than end of placeholder image.
Fixed BookStackApp#751

* Prevented markdown editor pushing out toolbar

* Fixed up notification styling a little

* Fixed large content previews and improved mobile styles

Listing content previews no longer pre-wrap and instead simply break
correctly.
Updated titles to ensure they break on mobile devices.
Reduced spacing and font sizes on mobile to better adjust content to
screen size.

Fixes BookStackApp#739

* Fixes a number of issues with the image uploader. Read below,

- Added a remove link to remove files that have an error.
- Error will appear below the progress bar.
- Hovering on dz-image or dz-details will display the error message. Otherwise error message was covering the remove link as well.
- Removed styling around the file size.
- Removed gradient effect in accordance with BookStack styling.
- Dropzone filenae will not overflow the container element. Also done for page attachments
- Added a 'uploaded' error message. this error was being thrown when the file size exceeded the server configured file size. (https://stackoverflow.com/a/42934387/903324)

Towards BookStackApp#741

Signed-off-by: Abijeet <[email protected]>

* Update activities.php

* Update auth.php

* Update common.php

* Update components.php

* Update settings.php

* Fixes the icons not being aligned properly in attached items section for the page.

Also formatting.

Signed-off-by: Abijeet <[email protected]>

* Update entities.php

* Updated webpack SCSS extract to provide sourcemaps

* Cleaned some form styling

Removed uppercasing of labels to make a little friendlier.
Extracted out toggleswitch JS into own component.
Improved basic code input for html-head-input area.

* Use autodiscover for dev packages

Allows installation with `composer install --no-dev`
Fixed BookStackApp#742

* Updated outline button styles for svg icons

* Removing the selected image and clearing the dropdzone on dialog close.

Towards BookStackApp#741

Signed-off-by: Abijeet <[email protected]>

* Not resizing gif images.

See - Intervention/image#176

Fixes BookStackApp#223

Signed-off-by: Abijeet <[email protected]>

* Fixes an issue with handling of large image files.

Signed-off-by: Abijeet <[email protected]>

* update japanese translation

* fix entities.php

* Fixed failing tests

Fixed syntax error in french translations.
Removed 'required' on image validation which was breaking tests

* Made search more efficient and tweaked weighting

Added per-entity weighting changes.
Now Books score higher than chapters which score higher than pages.

Reduced queries required on search by only searching once but at a
higher count to see if there's another page.

* Fixed incorrect search logic in last commit

Incorrect cross-entity pagination could lead to hidden entities.

* Properly escaped search results

Prevents vue-like syntax in results causing errors.
Related to BookStackApp#748

* Updated create routes to prevent slug clashes

Fixes BookStackApp#758

* Removed invalid bracket from view

* Ensured uploaded system images remain public

Also added tests to cover local_secure image storage.

Fixes BookStackApp#725

* Updated icons with height

Fixes issues within IE

* Updated assets for release v0.20.1

* Fixed export style paths

* Updated the version because i'm such a plonker

And forgot to do this last release.
I wonder if there's a simple commit hook that could prevent the same two
versions twice in a row?
  • Loading branch information
lassebenni authored Apr 13, 2018
1 parent 22df25a commit ea15364
Show file tree
Hide file tree
Showing 336 changed files with 22,139 additions and 6,664 deletions.
17 changes: 13 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ SESSION_DRIVER=file
#CACHE_DRIVER=memcached
#SESSION_DRIVER=memcached
QUEUE_DRIVER=sync
# A different prefix is useful when multiple BookStack instances use the same caching server
CACHE_PREFIX=bookstack

# Memcached settings
# If using a UNIX socket path for the host, set the port to 0
Expand Down Expand Up @@ -47,10 +49,15 @@ GITHUB_APP_SECRET=false
GOOGLE_APP_ID=false
GOOGLE_APP_SECRET=false
OKTA_BASE_URL=false
OKTA_KEY=false
OKTA_SECRET=false
OKTA_APP_ID=false
OKTA_APP_SECRET=false
TWITCH_APP_ID=false
TWITCH_APP_SECRET=false
GITLAB_APP_ID=false
GITLAB_APP_SECRET=false
GITLAB_BASE_URI=false

# External services such as Gravatar
# External services such as Gravatar and Draw.IO
DISABLE_EXTERNAL_SERVICES=false

# LDAP Settings
Expand All @@ -67,4 +74,6 @@ MAIL_HOST=localhost
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_ENCRYPTION=null
MAIL_FROM=null
MAIL_FROM_NAME=null
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Homestead.yaml
.idea
npm-debug.log
yarn-error.log
/public/dist
/public/dist/*.map
/public/plugins
/public/css/*.map
/public/js/*.map
Expand Down
8 changes: 5 additions & 3 deletions app/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ class Activity extends Model
*/
public function entity()
{
if ($this->entity_type === '') $this->entity_type = null;
if ($this->entity_type === '') {
$this->entity_type = null;
}
return $this->morphTo('entity');
}

Expand All @@ -43,8 +45,8 @@ public function getText()
* @param $activityB
* @return bool
*/
public function isSimilarTo($activityB) {
public function isSimilarTo($activityB)
{
return [$this->key, $this->entity_type, $this->entity_id] === [$activityB->key, $activityB->entity_type, $activityB->entity_id];
}

}
6 changes: 3 additions & 3 deletions app/Attachment.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php namespace BookStack;


class Attachment extends Ownable
{
protected $fillable = ['name', 'order'];
Expand All @@ -11,7 +10,9 @@ class Attachment extends Ownable
*/
public function getFileName()
{
if (str_contains($this->name, '.')) return $this->name;
if (str_contains($this->name, '.')) {
return $this->name;
}
return $this->name . '.' . $this->extension;
}

Expand All @@ -32,5 +33,4 @@ public function getUrl()
{
return baseUrl('/attachments/' . $this->id);
}

}
6 changes: 4 additions & 2 deletions app/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class Book extends Entity
{
public $searchFactor = 2;

protected $fillable = ['name', 'description', 'image_id'];

Expand All @@ -27,7 +28,9 @@ public function getUrl($path = false)
public function getBookCover($width = 440, $height = 250)
{
$default = baseUrl('/book_default_cover.png');
if (!$this->image_id) return $default;
if (!$this->image_id) {
return $default;
}

try {
$cover = $this->cover ? baseUrl($this->cover->getThumb($width, $height, false)) : $default;
Expand Down Expand Up @@ -91,5 +94,4 @@ public function entityRawQuery()
{
return "'BookStack\\\\Book' as entity_type, id, id as entity_id, slug, name, {$this->textField} as text,'' as html, '0' as book_id, '0' as priority, '0' as chapter_id, '0' as draft, created_by, updated_by, updated_at, created_at";
}

}
4 changes: 2 additions & 2 deletions app/Chapter.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php namespace BookStack;


class Chapter extends Entity
{
public $searchFactor = 1.3;

protected $fillable = ['name', 'description', 'priority', 'book_id'];

protected $with = ['book'];
Expand Down Expand Up @@ -59,5 +60,4 @@ public function entityRawQuery()
{
return "'BookStack\\\\Chapter' as entity_type, id, id as entity_id, slug, name, {$this->textField} as text, '' as html, book_id, priority, '0' as chapter_id, '0' as draft, created_by, updated_by, updated_at, created_at";
}

}
85 changes: 85 additions & 0 deletions app/Console/Commands/CreateAdmin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php

namespace BookStack\Console\Commands;

use BookStack\Repos\UserRepo;
use Illuminate\Console\Command;

class CreateAdmin extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bookstack:create-admin
{--email= : The email address for the new admin user}
{--name= : The name of the new admin user}
{--password= : The password to assign to the new admin user}';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Add a new admin user to the system';

protected $userRepo;

/**
* Create a new command instance.
*
* @param UserRepo $userRepo
*/
public function __construct(UserRepo $userRepo)
{
$this->userRepo = $userRepo;
parent::__construct();
}

/**
* Execute the console command.
*
* @return mixed
* @throws \BookStack\Exceptions\NotFoundException
*/
public function handle()
{
$email = trim($this->option('email'));
if (empty($email)) {
$email = $this->ask('Please specify an email address for the new admin user');
}
if (strlen($email) < 5 || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
return $this->error('Invalid email address provided');
}

if ($this->userRepo->getByEmail($email) !== null) {
return $this->error('A user with the provided email already exists!');
}

$name = trim($this->option('name'));
if (empty($name)) {
$name = $this->ask('Please specify an name for the new admin user');
}
if (strlen($name) < 2) {
return $this->error('Invalid name provided');
}

$password = trim($this->option('password'));
if (empty($password)) {
$password = $this->secret('Please specify a password for the new admin user');
}
if (strlen($password) < 5) {
return $this->error('Invalid password provided, Must be at least 5 characters');
}


$user = $this->userRepo->create(['email' => $email, 'name' => $name, 'password' => $password]);
$this->userRepo->attachSystemRole($user, 'admin');
$this->userRepo->downloadGravatarToUserAvatar($user);
$user->email_confirmed = true;
$user->save();

$this->info("Admin account with email \"{$user->email}\" successfully created!");
}
}
57 changes: 57 additions & 0 deletions app/Console/Commands/DeleteUsers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php

namespace BookStack\Console\Commands;

use BookStack\User;
use BookStack\Repos\UserRepo;
use Illuminate\Console\Command;

class DeleteUsers extends Command
{

/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bookstack:delete-users';

protected $user;

protected $userRepo;

/**
* The console command description.
*
* @var string
*/
protected $description = 'Delete users that are not "admin" or system users.';

public function __construct(User $user, UserRepo $userRepo)
{
$this->user = $user;
$this->userRepo = $userRepo;
parent::__construct();
}

public function handle()
{
$confirm = $this->ask('This will delete all users from the system that are not "admin" or system users. Are you sure you want to continue? (Type "yes" to continue)');
$numDeleted = 0;
if (strtolower(trim($confirm)) === 'yes') {
$totalUsers = $this->user->count();
$users = $this->user->where('system_name', '=', null)->with('roles')->get();
foreach ($users as $user) {
if ($user->hasSystemRole('admin')) {
// don't delete users with "admin" role
continue;
}
$this->userRepo->destroy($user);
++$numDeleted;
}
$this->info("Deleted $numDeleted of $totalUsers total users.");
} else {
$this->info('Exiting...');
}
}
}
27 changes: 22 additions & 5 deletions app/Entity.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<?php namespace BookStack;


use Illuminate\Database\Eloquent\Relations\MorphMany;

class Entity extends Ownable
{

/**
* @var string - Name of property where the main text content is found
*/
public $textField = 'description';

/**
* @var float - Multiplier for search indexing.
*/
public $searchFactor = 1.0;

/**
* Compares this entity to another given entity.
* Matches by comparing class and id.
Expand All @@ -28,7 +35,9 @@ public function matchesOrContains(Entity $entity)
{
$matches = [get_class($this), $this->id] === [get_class($entity), $entity->id];

if ($matches) return true;
if ($matches) {
return true;
}

if (($entity->isA('chapter') || $entity->isA('page')) && $this->isA('book')) {
return $entity->book_id === $this->id;
Expand Down Expand Up @@ -159,7 +168,9 @@ public static function getEntityInstance($type)
*/
public function getShortName($length = 25)
{
if (strlen($this->name) <= $length) return $this->name;
if (strlen($this->name) <= $length) {
return $this->name;
}
return substr($this->name, 0, $length - 3) . '...';
}

Expand All @@ -176,13 +187,19 @@ public function getText()
* Return a generalised, common raw query that can be 'unioned' across entities.
* @return string
*/
public function entityRawQuery(){return '';}
public function entityRawQuery()
{
return '';
}

/**
* Get the url of this entity
* @param $path
* @return string
*/
public function getUrl($path){return '/';}
public function getUrl($path)
{
return '/';
}

}
1 change: 0 additions & 1 deletion app/EntityPermission.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php namespace BookStack;


class EntityPermission extends Model
{

Expand Down
4 changes: 3 additions & 1 deletion app/Exceptions/AuthException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace BookStack\Exceptions;

class AuthException extends PrettyException
{

class AuthException extends PrettyException {}
}
4 changes: 3 additions & 1 deletion app/Exceptions/ConfirmationEmailException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace BookStack\Exceptions;

class ConfirmationEmailException extends NotifyException
{

class ConfirmationEmailException extends NotifyException {}
}
4 changes: 3 additions & 1 deletion app/Exceptions/FileUploadException.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php namespace BookStack\Exceptions;

class FileUploadException extends PrettyException
{

class FileUploadException extends PrettyException {}
}
Loading

0 comments on commit ea15364

Please sign in to comment.