Skip to content

Instantly share code, notes, and snippets.

@ssddanbrown
ssddanbrown / bs.postman_collection.json
Created Feb 10, 2022
BookStack Postman Collection
View bs.postman_collection.json
{
"info": {
"name": "BookStack REST API",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "DOCS",
"item": [
{
@ssddanbrown
ssddanbrown / examples.md
Created Feb 3, 2022
BookStack Laravel Examples
View examples.md

Originally put together when submitting to laravelexamples.com

I'm not particularly proud of the code-base in terms of cleanliness and style, but I'm proud of where it's got to over the last 6 years. Over those years my experience, knowledge and opinions have changed; And the code-base can often reflect that as inconsistency.

@ssddanbrown
ssddanbrown / functions.php
Created Jan 6, 2022
BookStack Webhook Call Before Hook Example
View functions.php
<?php
use BookStack\Actions\Webhook;
use BookStack\Entities\Models\Page;
use BookStack\Facades\Theme;
use BookStack\Theming\ThemeEvents;
Theme::listen(ThemeEvents::WEBHOOK_CALL_BEFORE, function (string $event, Webhook $webhook, $detail) {
@ssddanbrown
ssddanbrown / update-validation.php
Created Nov 5, 2021
Update Laravel Validation to be array-based
View update-validation.php
<?php
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
/** @var SplFileInfo $file */
foreach ($iterator as $file) {
$filePath = $file->getRealPath();
if ($file->getFilename() === 'update.php' || $file->isDir()) continue;
// Get controller file content and find validation rules
@ssddanbrown
ssddanbrown / docker-compose.yml
Last active Nov 4, 2021
bookstack-npm-docker-compose
View docker-compose.yml
---
version: "2"
services:
bookstack:
image: lscr.io/linuxserver/bookstack
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- APP_URL=https://wiki.bookstackapp.com
@ssddanbrown
ssddanbrown / functions.php
Created Jun 28, 2021
BookStack root URI page search via theme functions file
View functions.php
<?php
use BookStack\Entities\Models\Page;
use BookStack\Theming\ThemeEvents;
use BookStack\Facades\Theme;
use Illuminate\Http\Request;
// This will be the content of the functions.php file you'll have
// after following the getting started instructions here:
// https://github.com/BookStackApp/BookStack/blob/release/dev/docs/logical-theme-system.md
@ssddanbrown
ssddanbrown / example.js
Last active Feb 5, 2021
Get export-like HTML using the API
View example.js
// The BASE_URL of your BookStack instance, no trailing slash
const baseUrl = 'http://bookstack.local';
//////////////////
// USAGE EXAMPLE
///
// Get the export content for page ID 4
@ssddanbrown
ssddanbrown / docker-compose.yml
Created Jan 16, 2021
LSIO BookStack & Swag Setup
View docker-compose.yml
---
version: "2.1"
services:
swag:
image: ghcr.io/linuxserver/swag
container_name: swag
cap_add:
- NET_ADMIN
environment:
- PUID=1000
@ssddanbrown
ssddanbrown / update-bookstack.sh
Last active Nov 18, 2020 — forked from codemicro/update-bookstack.sh
Update a BookStack installation while also talking a backup
View update-bookstack.sh
#!/bin/bash
# BookStack backup & update script
# Forked from codemicro: https://gist.github.com/codemicro/f9dc94ecf5831772e1bff92dfba337d0
########### CONFIG ###########
# Configure this to be the location where BookStack is installed.
# Do not include a trailing slash
BOOKSTACK_DIR="/var/www/bookstack"
View foo.php
<?php
// Alter these to your instance, do not share publicly like this.
$base_api_url = 'http://bookstack.local/api/';
$token_id='ZNI62nNoghS3GyfzThlZFXqYNtHdHnM6';
$token_secret='zPffPZ1ATQcv4Nz75QYLEbMm6fPzmo7I';
// Id of the shelf we want to add our book to.
$shelfId = 12; // $_POST["category"]