diff --git a/bots/mail/settings.tpl b/bots/mail/settings.tpl new file mode 100644 index 0000000..aa1e1ed --- /dev/null +++ b/bots/mail/settings.tpl @@ -0,0 +1,19 @@ + +
+

Edit your mail subscription page

+

+ There is also a page where users can subscribe to mail notifications: + Ticketfrei {{city}}. + You can change what your users will read there, and adjust it to your + needs. +

+

+ So this is the default text we suggest: +

+
+ + + +
+
+ diff --git a/bots/mastodon/settings.tpl b/bots/mastodon/settings.tpl new file mode 100644 index 0000000..4e36403 --- /dev/null +++ b/bots/mastodon/settings.tpl @@ -0,0 +1,51 @@ + +
+

Log in with Mastodon

+
+ + + + + + + + + + + +
+
+ diff --git a/bots/telegram/settings.tpl b/bots/telegram/settings.tpl new file mode 100644 index 0000000..3939ced --- /dev/null +++ b/bots/telegram/settings.tpl @@ -0,0 +1,23 @@ + +<% +# todo: hide this part, if there is already a telegram bot connected. +%> +
+

Connect with Telegram

+

+ If you have a Telegram account, you can register a bot there. Just + write to @botfather. There are detailed instructions on + + Bots for Telegram. +

+

+ The botfather will give you an API key - with the API key, Ticketfrei + can use the Telegram bot. Enter it here: +

+
+ + + +
+
+ diff --git a/bots/twitter/settings.tpl b/bots/twitter/settings.tpl new file mode 100644 index 0000000..0847c23 --- /dev/null +++ b/bots/twitter/settings.tpl @@ -0,0 +1,10 @@ + + + + + + + + Log in with Twitter + + diff --git a/bots/twitterDMs/settings.tpl b/bots/twitterDMs/settings.tpl new file mode 100644 index 0000000..e69de29 diff --git a/frontend.py b/frontend.py index 7fbf975..f046dcd 100755 --- a/frontend.py +++ b/frontend.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 import bottle +from os import listdir, path from bottle import get, post, redirect, request, response, view from config import config from db import db @@ -271,6 +272,9 @@ logger.addHandler(fh) application = bottle.default_app() bottle.install(SessionPlugin('/')) +for bot in listdir('bots'): + bottle.TEMPLATE_PATH.insert(0, path.join('bots', bot, 'settings.tpl')) + if __name__ == '__main__': bottle.run(host="0.0.0.0", port=config["web"]["port"]) else: diff --git a/template/settings.tpl b/template/settings.tpl index 66cf873..35935c1 100644 --- a/template/settings.tpl +++ b/template/settings.tpl @@ -7,86 +7,16 @@
Enable
% end - - - - - - - Log in with Twitter - - -
-

Log in with Mastodon

-
- - - - - - - - - - - -
-
- <% -# todo: hide this part, if there is already a telegram bot connected. + +# import all the settings templates from bots/*/settings.tpl +import os +bots = os.listdir('bots') + +for bot in bots: + include('/home/b3yond/git/ticketfrei/bots/' + bot + '/settings.tpl', csrf=csrf, city=city) + %> -
-

Connect with Telegram

-

- If you have a Telegram account, you can register a bot there. Just - write to @botfather. There are detailed instructions on - - Bots for Telegram. -

-

- The botfather will give you an API key - with the API key, Ticketfrei - can use the Telegram bot. Enter it here: -

-
- - - -
-

Edit your city page