You can now edit markdown in settings. #18
This commit is contained in:
parent
f4736c91dd
commit
cd5eeb3917
|
@ -91,7 +91,7 @@ virtualenv -p python3 .
|
|||
Install the dependencies:
|
||||
|
||||
```shell
|
||||
pip install tweepy pytoml Mastodon.py bottle pyjwt pylibscrypt markdown2
|
||||
pip install tweepy pytoml Mastodon.py bottle pyjwt pylibscrypt Markdown
|
||||
```
|
||||
|
||||
Configure the bot:
|
||||
|
|
|
@ -93,6 +93,13 @@ def settings(user):
|
|||
return user.state()
|
||||
|
||||
|
||||
@post('/settings/markdown')
|
||||
@view('template/settings.tpl')
|
||||
def update_markdown(user):
|
||||
user.set_markdown(request.forms['markdown'])
|
||||
return user.state()
|
||||
|
||||
|
||||
@post('/settings/goodlist')
|
||||
@view('template/settings.tpl')
|
||||
def update_trigger_patterns(user):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
% rebase('template/wrapper.tpl')
|
||||
|
||||
<%
|
||||
import markdown2 as md
|
||||
import markdown as md
|
||||
|
||||
html = md.markdown(markdown)
|
||||
%>
|
||||
|
|
|
@ -75,8 +75,8 @@
|
|||
needs. <b>You should definitely adjust the Social Media profile links.</b> This is just the default text we
|
||||
suggest:
|
||||
</p>
|
||||
<form action="/settings/goodlist" method="post">
|
||||
<textarea id="markdown" rows="20" cols="70" name="goodlist" wrap="physical">{{markdown}}</textarea>
|
||||
<form action="/settings/markdown" method="post">
|
||||
<textarea id="markdown" rows="20" cols="70" name="markdown" wrap="physical">{{markdown}}</textarea>
|
||||
<input name='confirm' value='Save' type='submit'/>
|
||||
</form>
|
||||
</div>
|
||||
|
|
4
user.py
4
user.py
|
@ -227,6 +227,10 @@ schlitz
|
|||
"VALUES(?, ?, ?, ?);", (self.uid, access_token, instance_id, 1))
|
||||
db.commit()
|
||||
|
||||
def set_markdown(self, markdown):
|
||||
db.execute("UPDATE cities SET markdown = ? WHERE user_id = ?;",
|
||||
(markdown, self.uid))
|
||||
|
||||
def get_city(self):
|
||||
db.execute("SELECT city FROM cities WHERE user_id == ?;", (self.uid, ))
|
||||
return db.cur.fetchone()[0]
|
||||
|
|
Loading…
Reference in a new issue