ttbp/ttbp/config/__init__.py

133 lines
4.1 KiB
Python
Raw Normal View History

2017-11-21 06:02:10 +00:00
from __future__ import absolute_import
import os
2017-11-21 06:39:38 +00:00
import sys
2017-11-21 06:02:10 +00:00
2017-11-21 06:39:38 +00:00
from .. import util
2017-11-21 06:02:10 +00:00
## System config
# We refer to some package files (ie .css stuff), so we save a reference to the
# path.
2017-11-21 06:39:38 +00:00
INSTALL_PATH = os.path.dirname(sys.modules['ttbp'].__file__)
2017-11-21 06:02:10 +00:00
# We use this to store any persisted, global state.
VAR = '/var/global/ttbp'
VAR_WWW = os.path.join(VAR, 'www')
if not os.path.isdir('/var/global'):
raise Exception('bad system state: /var/global does not exist.')
if not os.path.isdir(VAR):
os.mkdir(VAR)
if not os.path.isdir(VAR_WWW):
os.mkdir(VAR_WWW)
LIVE = 'https://tilde.town/~'
FEEDBOX = "endorphant@tilde.town"
USERFILE = os.path.join(VAR, "users.txt")
GRAFF_DIR = os.path.join(VAR, "graffiti")
WALL = os.path.join(GRAFF_DIR, "wall.txt")
WALL_LOCK = os.path.join(GRAFF_DIR, ".lock")
2017-11-21 06:39:38 +00:00
if not os.path.isdir(GRAFF_DIR):
os.mkdir(GRAFF_DIR)
2017-11-21 06:02:10 +00:00
## Defaults
DEFAULT_HEADER = '''
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>$USER on TTBP</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="meta">
<h1><a href="#">~$USER</a>@<a href="/~endorphant/ttbp">TTBP</a></h1>
</div>
<div id="tlogs">
2017-11-21 06:39:38 +00:00
'''.lstrip()
2017-11-21 06:02:10 +00:00
DEFAULT_FOOTER = '''
</div>
</body>
</html>
2017-11-21 06:39:38 +00:00
'''.lstrip()
2017-11-21 06:02:10 +00:00
with open(os.path.join(INSTALL_PATH, 'config', 'defaults', 'style.css')) as f:
DEFAULT_STYLE = f.read()
## User config
USER = os.path.basename(os.path.expanduser('~'))
USER_HOME = os.path.expanduser('~')
PATH = os.path.join(USER_HOME, '.ttbp')
PUBLIC = os.path.join(USER_HOME, 'public_html')
WWW = os.path.join(PATH, 'www')
USER_CONFIG = os.path.join(PATH, 'config')
TTBPRC = os.path.join(USER_CONFIG, 'ttbprc')
USER_DATA = os.path.join(PATH, 'entries')
NOPUB = os.path.join(USER_CONFIG, "nopub")
## UI
BANNER = '''
__________________________________________________________
| |
| the tilde.town |
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
| ver 0.10.2 |
2017-11-21 06:02:10 +00:00
|__________________________________________________________|
2017-11-21 06:39:38 +00:00
'''.lstrip()
2017-12-31 17:21:05 +00:00
## update announcements
UPDATES = {
"0.9.0": """
ver. 0.9.0 features:
* browsing other people's feels from neighbor view
* documentation browser""",
"0.9.1": """
ver 0.9.1 features:
* graffiti wall """,
"0.9.2": """
ver 0.9.2 features:
* paginated entry view
* improved entry listing performance so it should
be less sluggish (for now)
* expanded menu for viewing your own feels (further features to be implemented) """,
"0.9.3": """
version 0.9.3 features:
* ttbp is now packaged, making it easier to contribute to.
* things should otherwise be the same!
* check out https://github.com/modgethanc/ttbp if you'd like to contribute.
* takes advantage of new /var/global """,
"0.10.1": """
~[version 0.10.1 features]~
* thanks to help from ~vilmibm, ttbp now supports publishing to gopher!
* if you enable gopher publishing, feels will automatically publish to
gopher://tilde.town/1/~{user}/feels
* if you don't know what gopher is, it's fine to opt-out; ask around on
irc if you'd like to learn more!
* the settings menu has been reworked to be less clunky""",
"0.10.2": """
~[version 0.10.2 update]~
* some errors in selecting and validating settings and creating publishing
directories have been corrected
* please send mail to ~endorphant or ask for help on IRC if you're still
having issues with getting your settings sorted out!
general PSA:
* join #ttbp on the local irc network for help and discussion about the
feels engine!
* ~login created centralfeels, which is an opt-in collection of
html-published feels; create a blank file called '.centralfeels' in
your home directory if you'd like to be included!""",
}