diff --git a/src/ttfrog/app.py b/src/ttfrog/app.py
index 341ed24..90a21cd 100644
--- a/src/ttfrog/app.py
+++ b/src/ttfrog/app.py
@@ -96,15 +96,16 @@ VIEW_URI=/
schema, self.path.database, sort_keys=True, indent=4, separators=(",", ": ")
)
- self.theme = Path(__file__).parent / "themes" / "default"
+ self.theme = Path(__file__).parent / "themes" / self.config.THEME
- self.web = Flask(self.config.NAME, template_folder=self.theme)
+ self.web = Flask(self.config.NAME, template_folder=self.theme, static_folder=self.theme / 'static')
self.web.config["SECRET_KEY"] = self.config.SECRET_KEY
self.web.config["SEND_FILE_MAX_AGE_DEFAULT"] = 0
self.web.config["DEBUG"] = True
self.web.config["SESSION_TYPE"] = "filesystem"
self.web.config["SESSION_REFRESH_EACH_REQUEST"] = True
self.web.config["SESSION_FILE_DIR"] = self.path.sessions
+
Session(self.web)
self._initialized = True
diff --git a/src/ttfrog/bootstrap.py b/src/ttfrog/bootstrap.py
new file mode 100644
index 0000000..48d3103
--- /dev/null
+++ b/src/ttfrog/bootstrap.py
@@ -0,0 +1,71 @@
+from ttfrog import app, schema
+
+TEMPLATE = """
+# Heading 1
+
+## Heading 2
+
+### Heading 3
+
+#### Heading 4
+
+##### Heading 5
+
+###### Heading 6
+
+***
+
+Normal text.
+**Bold text.**
+*Italic Text.*
+[A link](/).
+
+1. a
+2. numbered
+3. list.
+
+> a block quote
+
+| A | Table | Section |
+| --- | ----- | ------- |
+| foo | bar | baz |
+
+"""
+
+
+def bootstrap():
+ """
+ Bootstrap the database entries by populating the first Page, the Admin user and the Admins group.
+ """
+ app.check_state()
+
+ # create the top-level pages
+ root = app.db.save(schema.Page(name=app.config.VIEW_URI, title="Home", body="This is the home page"))
+
+ users = root.add_member(schema.Page(name="User", title="Users", body="users go here."))
+ groups = root.add_member(schema.Page(name="Group", title="Groups", body="groups go here."))
+ npcs = root.add_member(schema.Page(name="NPC", title="NPCS!", body="NPCS!"))
+ wiki = root.add_member(schema.Page(name="Wiki", title="Wiki", body=TEMPLATE))
+
+ # create the NPCs
+ npcs.add_member(schema.NPC(name="Sabetha", body=""))
+ npcs.add_member(schema.NPC(name="John", body=""))
+
+ # create the users
+ guest = users.add_member(schema.User(name="guest"))
+ admin = users.add_member(
+ schema.User(name=app.config.ADMIN_USERNAME, password="fnord", email=app.config.ADMIN_EMAIL)
+ )
+
+ # create the admin user and admins group
+ admins = groups.add_member(schema.Group(name="administrators", members=[admin]))
+
+ # admins get full access
+ root.set_permissions(
+ admins, permissions=[schema.Permissions.READ, schema.Permissions.WRITE, schema.Permissions.DELETE]
+ )
+
+ # guests get read access by default, except on Groups and Users
+ groups.set_permissions(guest, permissions=[])
+ users.set_permissions(guest, permissions=[])
+ root.set_permissions(guest, permissions=[schema.Permissions.READ])
diff --git a/src/ttfrog/themes/default/base.html b/src/ttfrog/themes/default/base.html
index d52ecc4..1aa379d 100644
--- a/src/ttfrog/themes/default/base.html
+++ b/src/ttfrog/themes/default/base.html
@@ -13,23 +13,26 @@
-