]> BookStack Code Mirror - website/blob - content/blog/2021/beta-release-v0-31-0.md
Organised blogposts into per-year folders
[website] / content / blog / 2021 / beta-release-v0-31-0.md
1 +++
2 categories = ["Releases"]
3 tags = ["Releases"]
4 title = "Beta Release v0.31.0"
5 date = 2021-01-03T21:30:00Z
6 author = "Dan Brown"
7 image = "/images/blog-cover-images/unsplash/winter-fox-birger-strahl.jpg"
8 description = "We begin 2021 with BookStack v0.31 which comes with recycle bin functionality, the page REST API endpoints and much more"
9 slug = "beta-release-v0-31-0"
10 draft = false
11 +++
12
13 We kick of this optimistic year with BookStack v0.31 which includes some great additions & updates to existing functionality including
14 a new recycle bin system, controllable item ownership, audit log changes, page API endpoints and much more.
15
16
17 * [Update instructions](https://www.bookstackapp.com/docs/admin/updates)
18 * [GitHub release page](https://github.com/BookStackApp/BookStack/releases/tag/v0.31.0)
19
20
21 Just to note, There were a few security releases for v0.30. If you're not upgrading from v0.30.7 be sure to 
22 read through the version specific notes on the [updates page](https://www.bookstackapp.com/docs/admin/updates).
23
24
25 ### Recycle Bin
26
27 Ever had an accidental deletion in your instance that you needed to undo? Now you can,
28 without having to restore a database backup, using the new recycle bin system. 
29 When you delete a shelf, book, chapter or page they'll now be sent to the recycle bin:
30
31
32 ![Recycle Bin Listing](/images/2021/01/recycle_bin.png)
33
34
35 On each item you can choose to restore or permanently delete it as required. By default, Items deleted
36 over 30 days ago may be automatically permanently deleted from the recycle bin.
37
38 The recycle bin can be accessed via the maintenance page where you'll also be provided with an overview of what is 
39 currently in the bin:
40
41 ![Recycle Bin Maintenance Overview](/images/2021/01/recycle_bin_maintenance.png)
42
43 The inclusion of the recycle bin also introduces a change into how chapter deletion works. Previously deleting
44 a chapter would cause all child pages to be moved to the parent book. From v0.31, deleting a chapter will send
45 the chapter and all child pages to the recycle bin. This aligns with the deletion behaviour of books.
46
47
48 ### Item Ownership
49
50 Since March in 2016 BookStack has had permissions available that permit the owner of content to make certain actions, For scenarios
51 such as "user is able to create pages within their own books". While potentially useful, these permissions were hard to 
52 use in practice since the owner would always simply be the creator.
53
54 In v0.31 the owner is now a separately tracked user, defaulting to the creator. The owner can be changed
55 on the permissions view of a shelf, book, chapter or page as shown below:
56
57 ![Page OwnerShip Change](/images/2021/01/ownership_change.png)
58
59 When you delete a user, you'll now be given the option to transfer ownership to another user if required.
60
61 These changes should make it much easier to setup scenarios where you have user-owned books where
62 they can only create, edit and delete within their own book.
63
64 ### Audit Log Updates
65
66 With the last feature release introducing the audit log, time has been spent this release cycle on expanding the tracked activities
67 to include many more events such as logins, user-management actions and settings update actions.
68
69 ![New Audit Log Activities](/images/2021/01/audit_log_updates.png)
70
71 ### User List Changes
72
73 A common requirement when managing users is to see who's inactive and therefore might need to be removed from the system.
74 This was previously tricky to do without direct database queries or careful manual monitoring but now in v0.31
75 the latest activity will now be shown on the users list within a sortable column:
76
77 ![User List with Latest Activity](/images/2021/01/user_list_activity.png)
78
79 Since you can sort by this column you can quickly find inactive users. Note, the latest activity date
80 reflected is based on the activity tracked in the audit-log, so does not include view/read only events but should 
81 include anything that counts as a modification. Activities made before v0.31 may not be reflected.
82
83 ### New Revision Changes System
84
85 When viewing a revision you have the option to preview pages.
86 This was done through the [gathercontent/htmldiff](https://github.com/gathercontent/htmldiff) which was great
87 but had not been supported in a while and required the PHP Tidy extension which could be tricky to locate and 
88 install on some systems. 
89
90 In v0.31 we've now switched to [ssddanbrown/htmldiff](https://github.com/ssddanbrown/htmldiff/) which I ported
91 from a [c# implementation found here](https://github.com/Rohland/htmldiff.net) which is a port of a [ruby implementation found here](https://github.com/myobie/htmldiff).  Major credit to [@Rohland](https://github.com/Rohland) and [@myobie](https://github.com/myobie) for their original work which I
92 have simply ported.
93
94 ![Revision Changes View](/images/2021/01/changes_view.png)
95
96 This new library does not have the PHP Tidy extension requirement so should make installation & maintenance
97 easier for some. From my testing this new library has appeared to work without issue but we will have to see
98 how it performs in wider use. 
99
100 ### API Update - Pages
101
102 This release brings page endpoints to the REST API. This completes the initial phase
103 of the API now that we have CRUD endpoints for shelves, books, chapters and pages.
104
105 ![Pages API Documentation](/images/2021/01/pages_api.png)
106
107 Now the core content parts are in place, I'm open to GitHub issues being created to request
108 specific features or endpoints so further actions can be performed. 
109
110 To support usage of the API, I've setup a new BookStack api-scripts repository on GitHub:
111 https://github.com/BookStackApp/api-scripts. This will be a collection of useful scripts I,
112 or others, create as examples or for specific tasks. These can be used directly, or as a base/guide to
113 create other scripts.
114
115
116 ### Iframe & Cookie Security Updates
117
118 Over the last 6 months some of the mainstream browsers have added additional protections for cookies,
119 restricting the default usage within a third-party context. For BookStack, this meant that access
120 through an iframe may not fully work due to cookies being blocked.
121
122 In v0.31, we've added additional controls to prevent usage within an iframe. [CSP frame-ancestors](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/frame-ancestors) headers will now be set, and used by modern browsers, to ensure it will only load within an iframe 
123 where the parent page is on the same host as BookStack. 
124
125 A new `ALLOWED_IFRAME_HOSTS` option, to be used in the `.env` file, can be used to allow iframe access for certain hosts. This can be used like so:
126
127 ```bash
128 # Adding a single host
129 ALLOWED_IFRAME_HOSTS="https://example.com"
130
131 # Mulitple hosts can be separated with a space
132 ALLOWED_IFRAME_HOSTS="https://a.example.com https://b.example.com"
133 ```
134
135 Setting this option will also adjust cookie security so that they can be set in a third-party context, and hence work when inside an iframe.
136
137 Details of this have been added to the [security page of the docs](/docs/admin/security/#iframe-control).
138
139
140 ### Translations
141
142 Big thanks to [@Swoy](https://github.com/BookStackApp/BookStack/pull/2336) who as provided Norwegian translations to BookStack for this release.
143 In addition, the below list shows the fantastic translators that have made changes since v0.30 and the languages they've updated:
144
145 * [@Swoy](https://github.com/BookStackApp/BookStack/pull/2336) - *Norwegian*
146 * Andrej Močan (andrejm) - *Slovenian*
147 * gilane9_ - *Arabic*
148 * Jakub Bouček (jakubboucek) - *Czech*
149 * Raed alnahdi (raednahdi) - *Arabic*
150 * rcy - *Swedish*
151 * Mykola Ronik (Mantikor) - *Ukrainian*
152 * m0uch0 - *Spanish*
153 * Xiphoseer - *German*
154 * 10935336 - *Chinese Simplified*
155 * MerlinSVK (merlinsvk) - *Slovak*
156 * nutsflag - *French*
157 * Kauê Sena (kaue.sena.ks) - *Portuguese, Brazilian*
158 * Leonardo Mario Martinez (leonardo.m.martinez) - *Spanish, Argentina*
159 * Vuong Trung Hieu (fpooon) - *Vietnamese*
160 * milesteg - *Hungarian*
161 * Statium - *Russian*
162 * Ghost_chu (dbguichu) - *Chinese Simplified*
163 * Ikhwan Koo (Ikhwan.Koo) - *Korean*
164 * Marco (cdrfun) - *German*
165 * MatthieuParis - *French*
166 * Douradinho - *Portuguese, Brazilian*
167 * Lowkey (v587ygq) - *Chinese Simplified*
168 * Beenbag - *German*
169 * ReadySystems - *Arabic*
170 * Gaku Yaguchi (tama11) - *Japanese*
171 * 孟繁阳 (FanyangMeng) - *Chinese Simplified*
172
173
174
175 ### Full List of Changes
176
177 * Added recycle bin implementation. ([#2283](https://github.com/BookStackApp/BookStack/pull/2283), [#2183](https://github.com/BookStackApp/BookStack/issues/2183), [#280](https://github.com/BookStackApp/BookStack/issues/280))
178 * Added Norwegian translations to BookStack. Thanks to [@Swoy](https://github.com/BookStackApp/BookStack/pull/2336). ([#2336](https://github.com/BookStackApp/BookStack/pull/2336))
179 * Added ownership system for pages, chapters, books and shelves. ([#2436](https://github.com/BookStackApp/BookStack/pull/2436), [#2246](https://github.com/BookStackApp/BookStack/issues/2246))
180 * Added host iframe control with cookie security management. ([#2427](https://github.com/BookStackApp/BookStack/issues/2427), [#2207](https://github.com/BookStackApp/BookStack/issues/2207))
181 * Added API endpoints for pages. ([#2382](https://github.com/BookStackApp/BookStack/pull/2382))
182 * Added many more activity types to the audit-log. ([#2360](https://github.com/BookStackApp/BookStack/pull/2360), [#1243](https://github.com/BookStackApp/BookStack/issues/1243))
183 * Added a sortable "Latest Activity" column to the users list. ([#848](https://github.com/BookStackApp/BookStack/issues/848))
184 * Replaced revision diff library so that the php tidy extension is no longer required. ([#2347](https://github.com/BookStackApp/BookStack/issues/2347), [#1553](https://github.com/BookStackApp/BookStack/issues/1553))
185 * Updated GitLab authentication to use the `read_user` scope. ([#2359](https://github.com/BookStackApp/BookStack/issues/2359))
186 * Updated revision restore to add sensible default change summary text. Thanks to [@rondaa](https://github.com/BookStackApp/BookStack/pull/2353). ([#2353](https://github.com/BookStackApp/BookStack/pull/2353), [#2349](https://github.com/BookStackApp/BookStack/issues/2349))
187 * Updated the "Cleanup Images" maintenance option wording for clarity. ([#2352](https://github.com/BookStackApp/BookStack/issues/2352))
188 * Updated dev docker setup to install composer dependencies in Docker entrypoint. Thanks to [@timoschwarzer](https://github.com/BookStackApp/BookStack/pull/2298). ([#2298](https://github.com/BookStackApp/BookStack/pull/2298))
189 * Updated chapter delete behaviour so pages are removed instead of being moved to the parent book. ([#2164](https://github.com/BookStackApp/BookStack/issues/2164))
190 * Updated grid-layout book/shelf item names to better fit into two lines. ([#1469](https://github.com/BookStackApp/BookStack/issues/1469))
191 * Updated translations. ([#2439](https://github.com/BookStackApp/BookStack/pull/2439), [#2327](https://github.com/BookStackApp/BookStack/pull/2327))
192 * Fixed issue where the export dropdown may show cut-off with options hidden. Thanks to [@shubhamosmosys](https://github.com/BookStackApp/BookStack/pull/2416). ([#2416](https://github.com/BookStackApp/BookStack/pull/2416))
193
194
195 ### Next Steps
196
197 Over the last few months we've had a good number of authentication-based pull requests, in addition to some others, which I've been somewhat ignoring so I'll
198 look to spend some time reviewing a few of those.
199
200 Now we have the core elements of the API integrated we'll now see what other features people may need. I'm imagining we'd add a few endpoints each future release for a while.
201
202 With the API base down and the activity system fleshed out, now may be a good time to implement an outbound web-hook system.
203 I'll likely create an implementation proposal so I can ensure we'd be covering the main use-cases required.
204
205 PHP 8 support is another thing I'll look to work on over the next release cycle. Some work has been put into this but, due to 
206 scale of changes in PHP 8 and the rate that some required packages move at, it's a trickier process than previous new PHP versions.
207
208 ----
209
210 <span style="font-size: 0.8em;opacity:0.9;">Header Image Credits: <span>Photo by <a href="https://unsplash.com/@bist31?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Birger Strahl</a> on <a href="https://unsplash.com/t/animals?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span></span>