Merge branch 'master' of github.com:modgethanc/ttbp

master
endorphant 2018-10-14 15:17:28 -04:00
commit 8967cf289d
4 changed files with 401 additions and 114 deletions

View File

@ -1,204 +1,287 @@
<p><em>a command-line based blogging platform running on tilde.town</em></p> <p><em>a command-line based blogging platform running on tilde.town</em></p>
<p><code>ttbp</code> stands for "tilde.town blogging platform", the original working name for
<p><code>ttbp</code> stands for &ldquo;tilde.town blogging platform&rdquo;, the original working name for
this project.</p> this project.</p>
<p><img alt="ttbp main menu screenshot" src="http://tilde.town/~endorphant/ttbp/screenshots/ttbp-main.png" /></p>
<p><img alt="ttbp entries view screenshot" src="http://tilde.town/~endorphant/ttbp/screenshots/ttbp-entries.png" /></p> <p><img src="http://tilde.town/~endorphant/ttbp/screenshots/ttbp-main.png" alt="ttbp main menu screenshot" /></p>
<p><img alt="ttbp compose view screenshot" src="http://tilde.town/~endorphant/ttbp/screenshots/ttbp-compose.png" /></p>
<p><img src="http://tilde.town/~endorphant/ttbp/screenshots/ttbp-entries.png" alt="ttbp entries view screenshot" /></p>
<p><img src="http://tilde.town/~endorphant/ttbp/screenshots/ttbp-compose.png" alt="ttbp compose view screenshot" /></p>
<p><code>ttbp</code> runs from the command line, providing a hub for writing personal blog <p><code>ttbp</code> runs from the command line, providing a hub for writing personal blog
posts and reading posts written by other users of tilde.town. it's a little bit posts and reading posts written by other users of tilde.town. it&rsquo;s a little bit
like livejournal or dreamwidth or tumblr. you can opt to publish your posts to a like livejournal or dreamwidth or tumblr. you can opt to publish your posts to a
public html file hosted on your tilde page, to tilde.town's gopher server, or public html file hosted on your tilde page, to tilde.town&rsquo;s gopher server, or
keep all your entries private to the tilde.town server.</p> keep all your entries private to the tilde.town server.</p>
<p>to use, run <code>feels</code> while logged in to tilde.town</p> <p>to use, run <code>feels</code> while logged in to tilde.town</p>
<p>this is a project that runs on tilde.town, so all users of this program are <p>this is a project that runs on tilde.town, so all users of this program are
expected to operate under the tilde.town <a href="http://tilde.town/wiki/conduct.html">code of expected to operate under the tilde.town <a href="http://tilde.town/wiki/conduct.html">code of
conduct</a>. content/personal issues should be conduct</a>. content/personal issues should be
worked out according to the CoC, with support from the <a href="http://tilde.town/wiki/administration/index.html">administrative worked out according to the CoC, with support from the <a href="http://tilde.town/wiki/administration/index.html">administrative
team</a> if needed.</p> team</a> if needed.</p>
<h3>QUICK START</h3> <h3>QUICK START</h3>
<p>no coding or html experience is necessary to get started. just log in to your <p>no coding or html experience is necessary to get started. just log in to your
tilde.town account and enter:</p> tilde.town account and enter:</p>
<p><code>feels</code></p> <p><code>feels</code></p>
<p>ttbp will ask you a few questions to get you started. after that, writing and <p>ttbp will ask you a few questions to get you started. after that, writing and
reading entries all happen within the program.</p> reading entries all happen within the program.</p>
<p>that's it!</p>
<p>that&rsquo;s it!</p>
<h3>support</h3> <h3>support</h3>
<p>if you're having trouble getting started, or run into program errors or strange
behavior, please send internal tilde.town mail to ~endorphant and i'll try to <p>if you&rsquo;re having trouble getting started, or run into program errors or strange
behavior, please send internal tilde.town mail to ~endorphant and i&rsquo;ll try to
sort things out!</p> sort things out!</p>
<p>there's also a function from the main menu that lets you send feedback/inquiries
to me directly; this uses internal tilde.town mail, which is what i'll respond <p>there&rsquo;s also a function from the main menu that lets you send feedback/inquiries
to me directly; this uses internal tilde.town mail, which is what i&rsquo;ll respond
to.</p> to.</p>
<h3>writing entries</h3> <h3>writing entries</h3>
<p>entries are recorded as plaintext files in your <code>~/.ttbp/entries</code> directory. <p>entries are recorded as plaintext files in your <code>~/.ttbp/entries</code> directory.
<code>ttbp</code> will use your selected editor to open and write files; each day is its <code>ttbp</code> will use your selected editor to open and write files; each day is its
own entry, like a diary page. at midnight for whatever timezone you've set for own entry, like a diary page. at midnight for whatever timezone you&rsquo;ve set for
your user account on tilde.town, you'll get a fresh entry. if you don't write your user account on tilde.town, you&rsquo;ll get a fresh entry. if you don&rsquo;t write
any feels on a particular day, no entries will show up there.</p> any feels on a particular day, no entries will show up there.</p>
<p>when you save and quit the text editor, your entry will automatically propagate <p>when you save and quit the text editor, your entry will automatically propagate
to the global feels list; if you've opted to publish your feels to html/gopher, to the global feels list; if you&rsquo;ve opted to publish your feels to html/gopher,
those files will update immediately. you can always go back to the current day's those files will update immediately. you can always go back to the current day&rsquo;s
entry and edit/add as you'd like, but older entries will not be available for entry and edit/add as you&rsquo;d like, but older entries will not be available for
editing from <code>ttbp</code>.</p> editing from <code>ttbp</code>.</p>
<p><em>(since files are just stored as plaintext in your directory, it's possible to
<p><em>(since files are just stored as plaintext in your directory, it&rsquo;s possible to
edit and move old entries directly from the command line. however, changing old edit and move old entries directly from the command line. however, changing old
entries might cause strange things to happen with timestamps. the main program entries might cause strange things to happen with timestamps. the main program
looks at the filename first for setting the date, then the last modified time to looks at the filename first for setting the date, then the last modified time to
sort recent posts. it expects YYYMMDD.txt as the filename; anything else won't sort recent posts. it expects YYYMMDD.txt as the filename; anything else won&rsquo;t
show up as a valid entry. yes, this means you can post things out of date order show up as a valid entry. yes, this means you can post things out of date order
by creating files with any date you want.)</em></p> by creating files with any date you want.)</em></p>
<h4>general entry-writing notes</h4> <h4>general entry-writing notes</h4>
<ul> <ul>
<li>you can use <a href="https://daringfireball.net/projects/markdown/syntax">markdown</a></li> <li>you can use <a href="https://daringfireball.net/projects/markdown/syntax">markdown</a></li>
<li>you can use html</li> <li>you can use html</li>
<li>you can also put things between <code>&lt;!-- comments --&gt;</code> to have them show up <li>you can also put things between <code>&lt;!-- comments --&gt;</code> to have them show up
in the feed but not render in a browser (but people can still read in the feed but not render in a browser (but people can still read
them with view-source)</li> them with view-source)</li>
</ul> </ul>
<h3>reading other feels</h3> <h3>reading other feels</h3>
<p>the <code>browse global feels</code> feature shows the ten most recent entries that anyone <p>the <code>browse global feels</code> feature shows the ten most recent entries that anyone
has written on ttbp. this list is only accessible from within tilde.town, has written on ttbp. this list is only accessible from within tilde.town,
although individual entries may be posted to html or gopher.</p> although individual entries may be posted to html or gopher.</p>
<p>you can also pull up a list of a single user's feels through <code>check out your
<p>you can also pull up a list of a single user&rsquo;s feels through <code>check out your
neighbors</code>, which displays all users who are writing on <code>ttbp</code> based on their neighbors</code>, which displays all users who are writing on <code>ttbp</code> based on their
most recently updated entry, and a link to their public html blog if they've most recently updated entry, and a link to their public html blog if they&rsquo;ve
opted to publish their posts.</p> opted to publish their posts.</p>
<p><strong>please note!</strong> entries written on <code>ttbp</code> should be considered sensitive, <p><strong>please note!</strong> entries written on <code>ttbp</code> should be considered sensitive,
private information, even if a particular user is publishing entries in a private information, even if a particular user is publishing entries in a
world-viewable way! please be respectful about having access to other people's world-viewable way! please be respectful about having access to other people&rsquo;s
feels, and do not copy/repeat any information without getting their explicit feels, and do not copy/repeat any information without getting their explicit
permission. tilde.town operates on a high level of mutual trust, and <code>ttbp</code> is permission. tilde.town operates on a high level of mutual trust, and <code>ttbp</code> is
designed to give individuals control over their content.</p> designed to give individuals control over their content.</p>
<h3>subscribing to users</h3>
<p>the <code>visit your subscriptions</code> feature lets you view recent entries from a list
of users you&rsquo;ve subscribed to, as well as manage your subscription list. your
list is saved to <code>~/.ttbp/config/subs</code>, which gets automatically updated when
you add or remove subscriptions from ttbp.</p>
<p>your subscription list is private; this means no one other than you can see who
you&rsquo;re following. subscription view only shows the 50 most recent entries from
your subscribe list; if you want to see more entries from an individual, you
can navigate to their entries in `check out your neighbors from the main
menu.</p>
<h3>privacy</h3> <h3>privacy</h3>
<p>when you start your ttbp, you have the option of publishing or not publishing <p>when you start your ttbp, you have the option of publishing or not publishing
your blog.</p> your blog.</p>
<p>if you opt to not publish, your entires will never be accessible from outside of <p>if you opt to not publish, your entires will never be accessible from outside of
the tilde.town network; other tilde.town users will still be able to read your the tilde.town network; other tilde.town users will still be able to read your
entries through the ttbp interface, or by directly accessing your entries through the ttbp interface, or by directly accessing your
<code>~/.ttbp/entries</code> directory.</p> <code>~/.ttbp/entries</code> directory.</p>
<p>if you want to further protect your entries, you can <code>chmod 700</code> your entries <p>if you want to further protect your entries, you can <code>chmod 700</code> your entries
directory.</p> directory.</p>
<p>if you opt to publish, the program creates a directory <code>~/.ttbp/www</code> where it <p>if you opt to publish, the program creates a directory <code>~/.ttbp/www</code> where it
stores all html files it generates, and symlinks this from your <code>~/public_html</code> stores all html files it generates, and symlinks this from your <code>~/public_html</code>
with your chosen blog directory. your blog will also be listed on the <a href="https://tilde.town/~endorphant/ttbp">main ttbp with your chosen blog directory. your blog will also be listed on the <a href="https://tilde.town/~endorphant/ttbp">main ttbp
page</a>.</p> page</a>.</p>
<p>you can also opt to publish to gopher, and the program will automatically <p>you can also opt to publish to gopher, and the program will automatically
generate a gophermap of your feels.</p> generate a gophermap of your feels.</p>
<p>you can set publishing status on individual entries, or bury individual feels; <p>you can set publishing status on individual entries, or bury individual feels;
see "data management" below for details.</p> see &ldquo;data management&rdquo; below for details.</p>
<h3>data management</h3> <h3>data management</h3>
<p>the <code>manage your feels</code> menu provides several tools for organizing your feels. <p>the <code>manage your feels</code> menu provides several tools for organizing your feels.
these are all actions you can perform manually from the command line, but doing these are all actions you can perform manually from the command line, but doing
them from within the program can help keep your files properly linked up.</p> them from within the program can help keep your files properly linked up.</p>
<ul> <ul>
<li><strong>read over feels</strong>--a list of all your entries, which you can open and <li><strong>read over feels</strong>&ndash;a list of all your entries, which you can open and
read like any other feel</li> read like any other feel</li>
<li><strong>modify feels publishing</strong>--this lets you toggle privacy on individual <li><strong>modify feels publishing</strong>&ndash;this lets you toggle privacy on individual
posts. entries marked <code>(nopub)</code> will not get written to html or gopher, posts. entries marked <code>(nopub)</code> will not get written to html or gopher,
and toggling them from this menu will immediately publish or unpublish and toggling them from this menu will immediately publish or unpublish
that entry (if you're not publishing your posts at all, these settings that entry (if you&rsquo;re not publishing your posts at all, these settings
won't matter, since your feels will never show up outside of tilde.town)</li> won&rsquo;t matter, since your feels will never show up outside of tilde.town)</li>
<li><strong>backup your feels</strong>--makes a .tar.gz of all your entries, saving one <li><strong>backup your feels</strong>&ndash;makes a .tar.gz of all your entries, saving one
copy to <code>~/.ttbp/backups/</code> with the current date, and a second copy to copy to <code>~/.ttbp/backups/</code> with the current date, and a second copy to
your home directory for safekeeping.</li> your home directory for safekeeping.</li>
<li><strong>import a feels backup</strong>--unpacks a backup file into your current feels <li><strong>import a feels backup</strong>&ndash;unpacks a backup file into your current feels
list. this tool checks the <code>~/.ttbp/backups</code> directory for archives, and list. this tool checks the <code>~/.ttbp/backups</code> directory for archives, and
expects a file created by the above backup utility. if it detects any file expects a file created by the above backup utility. if it detects any file
collisions, it will preserve your current live copy and leave the backup collisions, it will preserve your current live copy and leave the backup
verison in a temp directory, and notify you that this happened. also, any verison in a temp directory, and notify you that this happened. also, any
entries that were previously marked as <code>(nopub)</code> will retain their nopub entries that were previously marked as <code>(nopub)</code> will retain their nopub
status.</li> status.</li>
<li><strong>bury some feels</strong>--hides individual feels from viewing; entries are <li><strong>bury some feels</strong>&ndash;hides individual feels from viewing; entries are
moved to <code>~/.ttbp/buried</code> (and marked with a unique timestamp to prevent moved to <code>~/.ttbp/buried</code> (and marked with a unique timestamp to prevent
file collision) with permissions set to 600, meaning no one except you file collision) with permissions set to 600, meaning no one except you
will be able to open that file. these entries are also hidden from your will be able to open that file. these entries are also hidden from your
own view from <code>read over feels</code>, and you'll have to open the files from own view from <code>read over feels</code>, and you&rsquo;ll have to open the files from
the command line if you want to see them. this is intended to be a the command line if you want to see them. this is intended to be a
permament action, so you'll be asked to type the entry date once to load permament action, so you&rsquo;ll be asked to type the entry date once to load
the feel, then shown a preview of that feel, and then type the date again the feel, then shown a preview of that feel, and then type the date again
to confirm burying.</li> to confirm burying.</li>
<li><strong>delete feels by day</strong>--<em>permanently removes individual entries</em>, <li><strong>delete feels by day</strong>&ndash;<em>permanently removes individual entries</em>,
including deleting published html/gopher files if needed. this action is including deleting published html/gopher files if needed. this action is
not recoverable, unless you have a backup to restore; you'll be asked to not recoverable, unless you have a backup to restore; you&rsquo;ll be asked to
type the entry date once to load the feel, then shown a preview of that type the entry date once to load the feel, then shown a preview of that
feel, and then type the date again to confirm deletion.</li> feel, and then type the date again to confirm deletion.</li>
<li><strong>purge all feels</strong>--<em>permanently removes all feels</em>, including deleting <li><strong>purge all feels</strong>&ndash;<em>permanently removes all feels</em>, including deleting
all published html/gopher files if needed. this action is not recoverable, all published html/gopher files if needed. this action is not recoverable,
unless you have a backup to restore. you'll be asked to type a unless you have a backup to restore. you&rsquo;ll be asked to type a
one-time-use purge code to confirm this action.</li> one-time-use purge code to confirm this action.</li>
<li><strong>wipe feels account</strong>--<em>permanently removes all data associated with <li><strong>wipe feels account</strong>&ndash;<em>permanently removes all data associated with
feels</em>, including deleting any published hmtl/gopher files and removing feels</em>, including deleting any published hmtl/gopher files and removing
your <code>~/.ttbp</code> directory. any backups that you have in <code>~/.ttbp/backups</code> your <code>~/.ttbp</code> directory. any backups that you have in <code>~/.ttbp/backups</code>
will also be deleted with this action (which is why the backup function will also be deleted with this action (which is why the backup function
makes a second copy for safekeeping in your home directory). you will no makes a second copy for safekeeping in your home directory). you will no
longer show up in any lists as a user.</li> longer show up in any lists as a user.</li>
</ul> </ul>
<h3>settings</h3> <h3>settings</h3>
<p>the settings menu lets you change specific options for handling your feels and <p>the settings menu lets you change specific options for handling your feels and
using the interface.</p> using the interface.</p>
<ul> <ul>
<li><strong>editor</strong>--set your text editor</li> <li><strong>editor</strong>&ndash;set your text editor</li>
<li><strong>gopher</strong>--opt in or out of automatically posting to gopher</li> <li><strong>gopher</strong>&ndash;opt in or out of automatically posting to gopher</li>
<li><strong>post as nopub</strong>--set whether posts default to being published or not <li><strong>post as nopub</strong>&ndash;set whether posts default to being published or not
published (if you're not publishing your feels, this doesn't matter)</li> published (if you&rsquo;re not publishing your feels, this doesn&rsquo;t matter)</li>
<li><strong>publish dir</strong>--set the directory under you <code>public_html</code> where feels will be <li><strong>publish dir</strong>&ndash;set the directory under you <code>public_html</code> where feels will be
published (if you're not publishing your feels, this defaults to <code>None</code>)</li> published (if you&rsquo;re not publishing your feels, this defaults to <code>None</code>)</li>
<li><strong>publishing</strong>--opt in or out of automatically publishing entries to a <li><strong>publishing</strong>&ndash;opt in or out of automatically publishing entries to a
world-readable html page</li> world-readable html page</li>
<li><strong>rainbows</strong>--opt in or out of having multicolored menu text</li> <li><strong>rainbows</strong>&ndash;opt in or out of having multicolored menu text</li>
</ul> </ul>
<h3>changing your page layout</h3> <h3>changing your page layout</h3>
<p>you can modify how your blog looks by editing the stylesheet or header and <p>you can modify how your blog looks by editing the stylesheet or header and
footer files. the program sets you up with basic default. if you break your page footer files. the program sets you up with basic default. if you break your page
somehow, you can force the program to regenerate your configuration by deleting somehow, you can force the program to regenerate your configuration by deleting
your ~/.ttbp directory entirely. <strong>you might want to back up your your ~/.ttbp directory entirely. <strong>you might want to back up your
~/.ttbp/entries directory before you do this.</strong></p> ~/.ttbp/entries directory before you do this.</strong></p>
<ul> <ul>
<li>to modify your stylesheet, edit your ~/.ttbp/config/style.css</li> <li>to modify your stylesheet, edit your ~/.ttbp/config/style.css</li>
<li>to modify the page header, edit your ~/.ttbp/config/header.txt</li> <li>to modify the page header, edit your ~/.ttbp/config/header.txt
<li>there's a place marked off in the default header where you can safely put
custom HTML elements!</li> <ul>
<li>there&rsquo;s a place marked off in the default header where you can safely put
custom HTML elements!</li>
</ul>
</li>
<li>to modify the page footer, edit your ~/.ttbp/config/footer.txt</li> <li>to modify the page footer, edit your ~/.ttbp/config/footer.txt</li>
</ul> </ul>
<h3>general tips/troubleshooting</h3> <h3>general tips/troubleshooting</h3>
<ul> <ul>
<li>if the date looks like it's ahead or behind, it's because you haven't set <li>if the date looks like it&rsquo;s ahead or behind, it&rsquo;s because you haven&rsquo;t set
your local timezone yet. here are some your local timezone yet. here are some
<a href="http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/">timezone setting instructions</a></li> <a href="http://www.cyberciti.biz/faq/linux-unix-set-tz-environment-variable/">timezone setting instructions</a></li>
<li>the feels burying tool will effectively clear your post for the day; you can <li>the feels burying tool will effectively clear your post for the day; you can
use this feature to start a fresh entry on a particular day by burying the use this feature to start a fresh entry on a particular day by burying the
current day's feels and then editing a new file</li> current day&rsquo;s feels and then editing a new file</li>
</ul> </ul>
<h3>future features</h3> <h3>future features</h3>
<p>these are a few ideas being kicked around, or under active development:</p> <p>these are a few ideas being kicked around, or under active development:</p>
<ul> <ul>
<li>stylesheet/theme selector</li> <li>stylesheet/theme selector</li>
<li>better entry display within ttbp (currently just offloads to <code>less</code>)</li> <li>better entry display within ttbp (currently just offloads to <code>less</code>)</li>
<li>buried feels browser</li> <li>buried feels browser</li>
</ul> </ul>
<p>other ideas are listed on github as <p>other ideas are listed on github as
<a href="https://github.com/modgethanc/ttbp/issues?q=is%3Aissue+is%3Aopen+label%3A" title="upcoming+features">upcoming features</a> or <a href="https://github.com/modgethanc/ttbp/issues?q=is%3Aissue+is%3Aopen+label%3A" title="feature+request">feature requests</a>!</p> <a href="https://github.com/modgethanc/ttbp/issues?q=is%3Aissue+is%3Aopen+label%3A" title="upcoming+features">upcoming features</a> or <a href="https://github.com/modgethanc/ttbp/issues?q=is%3Aissue+is%3Aopen+label%3A" title="feature+request">feature requests</a>!</p>
<h3>dependencies</h3> <h3>dependencies</h3>
<p>(this section is only relevant if you plan on forking the repo and running an <p>(this section is only relevant if you plan on forking the repo and running an
instance of this yourself)</p> instance of this yourself)</p>
<ul> <ul>
<li><a href="https://pypi.python.org/pypi/mistune">mistune</a></li> <li><a href="https://pypi.python.org/pypi/mistune">mistune</a></li>
<li><a href="https://pypi.python.org/pypi/inflect">inflect</a></li> <li><a href="https://pypi.python.org/pypi/inflect">inflect</a></li>
<li><a href="https://pypi.python.org/pypi/six">six</a></li> <li><a href="https://pypi.python.org/pypi/six">six</a></li>
</ul> </ul>
<h3>contributing</h3> <h3>contributing</h3>
<p>please check out my <a href="https://github.com/modgethanc/ttbp/blob/master/.github/CONTRIBUTING.md">contributor <p>please check out my <a href="https://github.com/modgethanc/ttbp/blob/master/.github/CONTRIBUTING.md">contributor
guidelines</a> guidelines</a>
on github if you'd like to get involved with development!</p> on github if you&rsquo;d like to get involved with development!</p>
<p>if you find any bugs or strange behavior, please message me locally on tildemail <p>if you find any bugs or strange behavior, please message me locally on tildemail
or open a github issue and i'll get back to you as soon as i can.</p> or open a github issue and i&rsquo;ll get back to you as soon as i can.</p>
<p>if you're interested in helping with the code, please drop me some tildemail!</p>
<p>if you&rsquo;re interested in helping with the code, please drop me some tildemail!</p>
<p>i accept tips for development work on <p>i accept tips for development work on
<a href="https://liberapay.com/modgethanc">liberapay</a></p> <a href="https://liberapay.com/modgethanc">liberapay</a></p>
<h3>contributor shout-outs</h3> <h3>contributor shout-outs</h3>
<p>thanks to:</p> <p>thanks to:</p>
<ul> <ul>
<li>~vilmibm, packaging help and gopher support</li> <li>~vilmibm, packaging help and gopher support</li>
<li>~sanqui, the bug swatter</li> <li>~sanqui, the bug swatter</li>
<li>~sinacutie, for css updates</li> <li>~sinacutie, for css updates</li>
</ul> </ul>

View File

@ -94,6 +94,19 @@ feels, and do not copy/repeat any information without getting their explicit
permission. tilde.town operates on a high level of mutual trust, and `ttbp` is permission. tilde.town operates on a high level of mutual trust, and `ttbp` is
designed to give individuals control over their content. designed to give individuals control over their content.
### subscribing to users
the `visit your subscriptions` feature lets you view recent entries from a list
of users you've subscribed to, as well as manage your subscription list. your
list is saved to `~/.ttbp/config/subs`, which gets automatically updated when
you add or remove subscriptions from ttbp.
your subscription list is private; this means no one other than you can see who
you're following. subscription view only shows the 50 most recent entries from
your subscribe list; if you want to see more entries from an individual, you
can navigate to their entries in `check out your neighbors from the main
menu.
### privacy ### privacy
when you start your ttbp, you have the option of publishing or not publishing when you start your ttbp, you have the option of publishing or not publishing

View File

@ -76,6 +76,7 @@ MAIN_FEELS = os.path.join(PATH, 'entries')
BURIED_FEELS = os.path.join(PATH, 'buried') BURIED_FEELS = os.path.join(PATH, 'buried')
NOPUB = os.path.join(USER_CONFIG, 'nopub') NOPUB = os.path.join(USER_CONFIG, 'nopub')
BACKUPS = os.path.join(PATH, 'backups') BACKUPS = os.path.join(PATH, 'backups')
SUBS = os.path.join(USER_CONFIG, 'subs')
## UI ## UI
@ -86,7 +87,7 @@ ___________________________________________________________
| ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ | | ____ ____ ____ _ ____ ____ _ _ ____ _ _ _ ____ |
| |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ | | |___ |___ |___ | [__ |___ |\ | | __ | |\ | |___ |
| | |___ |___ |___ ___] |___ | \| |__] | | \| |___ | | | |___ |___ |___ ___] |___ | \| |__] | | \| |___ |
| <gan jue; to feel> ver 0.12.0 | | <gan jue; to feel> ver 0.12.1 |
|__________________________________________________________| |__________________________________________________________|
'''.lstrip() '''.lstrip()
# ~ u n s t a b l e e x p e r i m e n t a l b r a n c h ~ # ~ u n s t a b l e e x p e r i m e n t a l b r a n c h ~
@ -291,5 +292,21 @@ version 0.9.3 features:
i'm just making this option available for anyone whose financially stable i'm just making this option available for anyone whose financially stable
and wants to kick some spare change my way; this is a labor of love, and i'm and wants to kick some spare change my way; this is a labor of love, and i'm
happy to work on it regardless :) happy to work on it regardless :)
""",
"0.12.1":"""
~[version 0.12.1 update]~
new feature: "visit your subscriptions"
* view recent entries from a list of townies you've subscribed to
* subscription list is private; no one else can see who you're following
* add/remove users from the subscription menu
minor changes:
* global feed now shows 50 most recent entries, which you can scroll through
* documentation page updated to reflect new feature
thanks for those of your who've written me with feedback!
keep feelin' together <3
""" """
} }

View File

@ -51,7 +51,7 @@ from . import chatter
from . import gopher from . import gopher
from . import util from . import util
__version__ = "0.12.0" __version__ = "0.12.1"
__author__ = "endorphant <endorphant@tilde.town)" __author__ = "endorphant <endorphant@tilde.town)"
p = inflect.engine() p = inflect.engine()
@ -529,10 +529,11 @@ def main_menu():
''' '''
menuOptions = [ menuOptions = [
"record your feels", "record some feels",
"manage your feels", "manage your feels",
"check out your neighbors", "check out your neighbors",
"browse global feels", "browse global feels",
"visit your subscriptions",
"scribble some graffiti", "scribble some graffiti",
"change your settings", "change your settings",
"send some feedback", "send some feedback",
@ -567,19 +568,23 @@ def main_menu():
view_neighbors(users, prompt) view_neighbors(users, prompt)
elif choice == '3': elif choice == '3':
redraw("most recent global entries") redraw("most recent global entries")
view_feed() view_global_feed()
elif choice == '4': elif choice == '4':
graffiti_handler() intro = "your subscriptions list is private; no one but you will know who you're following.\n\n> here are some options for your subscriptions:"
redraw(intro)
subscription_handler(intro)
elif choice == '5': elif choice == '5':
graffiti_handler()
elif choice == '6':
redraw("now changing your settings. press <ctrl-c> if you didn't mean to do this.") redraw("now changing your settings. press <ctrl-c> if you didn't mean to do this.")
core.load(setup()) # reload settings to core core.load(setup()) # reload settings to core
elif choice == '6': elif choice == '7':
redraw("you're about to send mail to ~endorphant about ttbp") redraw("you're about to send mail to ~endorphant about ttbp")
feedback_menu() feedback_menu()
elif choice == '7': elif choice == '8':
redraw() redraw()
show_credits() show_credits()
elif choice == '8': elif choice == '9':
subprocess.call(["lynx", os.path.join(config.INSTALL_PATH, "..", "doc", "manual.html")]) subprocess.call(["lynx", os.path.join(config.INSTALL_PATH, "..", "doc", "manual.html")])
redraw() redraw()
elif choice in QUITS: elif choice in QUITS:
@ -690,6 +695,56 @@ def review_menu(intro=""):
redraw(top+intro) redraw(top+intro)
return review_menu(intro) return review_menu(intro)
def subscription_handler(intro=""):
'''
submenu for managing subscriptions
'''
if not os.path.exists(config.SUBS):
subprocess.call(["touch", config.SUBS])
subprocess.call(["chmod", "600", config.SUBS])
subs_raw = []
if os.path.isfile(config.SUBS):
for line in open(config.SUBS, "r"):
subs_raw.append(line.rstrip())
subs = []
all_users = core.find_ttbps()
for name in subs_raw:
if name in all_users:
subs.append(name)
menuOptions = [
"view subscribed feed",
"manage subscriptions"
]
util.print_menu(menuOptions, SETTINGS.get("rainbows", False))
choice = util.list_select(menuOptions, "what would you like to do with your subscriptions? (or 'q' to return home) ")
top = ""
if choice is not False:
if choice == 0:
if len(subs) > 0:
prompt = "most recent entries from your subscribed pals:"
redraw(prompt)
view_subscribed_feed(subs, prompt)
else:
intro = "it doesn't look like you have any subscriptions to see! add pals with 'manage subscriptions' here."
elif choice == 1:
prompt = "options for managing your subscriptions:"
redraw(prompt)
subscription_manager(subs, prompt)
else:
redraw()
return
redraw(top+intro)
return subscription_handler(intro)
def view_neighbors(users, prompt): def view_neighbors(users, prompt):
''' '''
generates list of all users on ttbp, sorted by most recent post generates list of all users on ttbp, sorted by most recent post
@ -1275,14 +1330,43 @@ def show_entry(filename):
return return
def view_feed(): def view_global_feed():
''' '''
generate and display list of most recent global entries display list of most recent global entries
'''
(entries, metas)= feed_list(core.find_ttbps())
list_entries(metas, entries, "recent global entries:")
redraw()
return
def view_subscribed_feed(subs, prompt=""):
'''
display list of most recent entries on user's subscribed list.
'''
(entries, metas)= feed_list(subs, 0)
list_entries(metas, entries, prompt)
redraw()
return
def feed_list(townies, delta=30):
'''
given a list of townies, generate a list of 50 most recent entries within
given interval (default 30 days; 0 days for no limit). validates against
townies with ttbp config files.
returns a tuple of (entries, metas)
''' '''
feedList = [] feedList = []
all_users = core.find_ttbps()
for townie in townies:
if townie not in all_users:
continue
for townie in core.find_ttbps():
entryDir = os.path.join("/home", townie, ".ttbp", "entries") entryDir = os.path.join("/home", townie, ".ttbp", "entries")
try: try:
filenames = os.listdir(entryDir) filenames = os.listdir(entryDir)
@ -1290,23 +1374,25 @@ def view_feed():
filenames = [] filenames = []
for entry in filenames: for entry in filenames:
## hardcoded display cutoff at 30 days if delta > 0:
if core.valid(entry): if core.valid(entry):
year = int(entry[0:4]) year = int(entry[0:4])
month = int(entry[4:6]) month = int(entry[4:6])
day = int(entry[6:8]) day = int(entry[6:8])
datecheck = datetime.date(year, month, day) datecheck = datetime.date(year, month, day)
displayCutoff = datetime.date.today() - datetime.timedelta(days=30) displayCutoff = datetime.date.today() - datetime.timedelta(days=delta)
if datecheck > displayCutoff: if datecheck > displayCutoff:
feedList.append(os.path.join(entryDir, entry)) feedList.append(os.path.join(entryDir, entry))
else:
feedList.append(os.path.join(entryDir, entry))
metas = core.meta(feedList) metas = core.meta(feedList)
metas.sort(key = lambda entry:entry[3]) metas.sort(key = lambda entry:entry[3])
metas.reverse() metas.reverse()
entries = [] entries = []
for entry in metas[0:10]: for entry in metas[0:50]:
pad = "" pad = ""
if len(entry[5]) < 8: if len(entry[5]) < 8:
pad = "\t" pad = "\t"
@ -1315,12 +1401,96 @@ def view_feed():
user=entry[5], pad=pad, date=entry[3], user=entry[5], pad=pad, date=entry[3],
wordcount=p.no("word", entry[2]))) wordcount=p.no("word", entry[2])))
list_entries(metas, entries, "most recent global entries:") return entries, metas
def subscription_manager(subs, intro=""):
'''
'''
menuOptions = [
"add pals",
"remove pals"
]
util.print_menu(menuOptions, SETTINGS.get("rainbows", False))
choice = util.list_select(menuOptions, "what do you want to do? (enter 'q' to go back) ")
top = ""
if choice is not False:
if choice == 0:
prompt = "list of townies recording feels:"
redraw(prompt)
subs = subscribe_handler(subs, prompt)
elif choice == 1:
prompt = "list of townies you're subscribed to:"
redraw(prompt)
subs = unsubscribe_handler(subs, prompt)
else:
redraw() redraw()
return return
redraw(top+intro)
return subscription_manager(subs, intro)
def unsubscribe_handler(subs, prompt):
'''
displays a list of currently subscribed users and toggles deletion.
'''
subs.sort()
choice = menu_handler(subs, "pick a pal to unsubscribe (or 'q' to cancel): ", 15, SETTINGS.get("rainbows", False), "list of townies recording feels:")
if choice is not False:
townie = subs[choice]
subs.remove(townie)
save_subs(subs)
redraw("{townie} removed! \n\n> {prompt}".format(townie=townie, prompt=prompt))
return unsubscribe_handler(subs, prompt)
else:
redraw()
return subs
def subscribe_handler(subs, prompt):
'''
displays a list of all users not subscribed to and toggles adding,
returning the subs list when finished.
'''
candidates = []
for townie in core.find_ttbps():
if townie not in subs:
candidates.append(townie)
candidates.sort()
choice = menu_handler(candidates, "pick a townie to add to your subscriptions (or 'q' to cancel): ", 15, SETTINGS.get("rainbows", False), "list of townies recording feels:")
if choice is not False:
townie = candidates[choice]
subs.append(townie)
save_subs(subs)
redraw("{townie} added! \n\n> {prompt}".format(townie=townie, prompt=prompt))
return subscribe_handler(subs, prompt)
else:
redraw()
return subs
def save_subs(subs):
'''
takes given subscription list and saves it into the user config,
overwriting whatever is already there.
'''
subs_file = open(config.SUBS, 'w')
for townie in subs:
subs_file.write(townie + "\n")
subs_file.close()
def graffiti_handler(): def graffiti_handler():
''' '''
Main graffiti handler. Main graffiti handler.
@ -1710,15 +1880,15 @@ something strange happened to you during this update.
# version 0.11.0 patch notes # version 0.11.0 patch notes
print(config.UPDATES["0.11.0"]) print(config.UPDATES["0.11.0"])
if y < 11 or z < 1: if y < 11 and z < 1:
# version 0.11.1 patch notes # version 0.11.1 patch notes
print(config.UPDATES["0.11.1"]) print(config.UPDATES["0.11.1"])
if y < 11 or z < 2: if y < 11 and z < 2:
# version 0.11.2 patch notes # version 0.11.2 patch notes
print(config.UPDATES["0.11.2"]) print(config.UPDATES["0.11.2"])
if y < 11 or z < 3: if y < 11 and z < 3:
# version 0.11.3 patch notes # version 0.11.3 patch notes
print(config.UPDATES["0.11.3"]) print(config.UPDATES["0.11.3"])
@ -1726,6 +1896,10 @@ something strange happened to you during this update.
# version 0.12.0 patch notes # version 0.12.0 patch notes
print(config.UPDATES["0.12.0"]) print(config.UPDATES["0.12.0"])
if z < 1:
# version 0.12.1 patch notes
print(config.UPDATES["0.12.1"])
confirm = "" confirm = ""
while confirm not in ("x", "<x>", "X", "<X>"): while confirm not in ("x", "<x>", "X", "<X>"):