remarkbox 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. remarkbox-0.0.1/MANIFEST.in +2 -0
  2. remarkbox-0.0.1/PKG-INFO +290 -0
  3. remarkbox-0.0.1/README.rst +277 -0
  4. remarkbox-0.0.1/development.ini +155 -0
  5. remarkbox-0.0.1/journal.rst +260 -0
  6. remarkbox-0.0.1/readme-postgres-notes.rst +101 -0
  7. remarkbox-0.0.1/readme-themes.rst +14 -0
  8. remarkbox-0.0.1/remarkbox/__init__.py +556 -0
  9. remarkbox-0.0.1/remarkbox/lib/__init__.py +36 -0
  10. remarkbox-0.0.1/remarkbox/lib/mail.py +221 -0
  11. remarkbox-0.0.1/remarkbox/lib/mail_messages.py +117 -0
  12. remarkbox-0.0.1/remarkbox/lib/notify.py +260 -0
  13. remarkbox-0.0.1/remarkbox/lib/render.py +60 -0
  14. remarkbox-0.0.1/remarkbox/lib/sanitize_html.py +227 -0
  15. remarkbox-0.0.1/remarkbox/lib/svgtar/__init__.py +54 -0
  16. remarkbox-0.0.1/remarkbox/lib/svgtar/svg.py +46 -0
  17. remarkbox-0.0.1/remarkbox/models/__init__.py +88 -0
  18. remarkbox-0.0.1/remarkbox/models/event.py +41 -0
  19. remarkbox-0.0.1/remarkbox/models/meta.py +156 -0
  20. remarkbox-0.0.1/remarkbox/models/namespace.py +428 -0
  21. remarkbox-0.0.1/remarkbox/models/namespace_request.py +214 -0
  22. remarkbox-0.0.1/remarkbox/models/namespace_user.py +44 -0
  23. remarkbox-0.0.1/remarkbox/models/node.py +674 -0
  24. remarkbox-0.0.1/remarkbox/models/node_cache.py +88 -0
  25. remarkbox-0.0.1/remarkbox/models/notification.py +97 -0
  26. remarkbox-0.0.1/remarkbox/models/oauth.py +64 -0
  27. remarkbox-0.0.1/remarkbox/models/pay_what_you_can.py +39 -0
  28. remarkbox-0.0.1/remarkbox/models/uri.py +139 -0
  29. remarkbox-0.0.1/remarkbox/models/user.py +441 -0
  30. remarkbox-0.0.1/remarkbox/models/vote.py +30 -0
  31. remarkbox-0.0.1/remarkbox/models/watcher.py +80 -0
  32. remarkbox-0.0.1/remarkbox/routes.py +131 -0
  33. remarkbox-0.0.1/remarkbox/scripts/__init__.py +7 -0
  34. remarkbox-0.0.1/remarkbox/scripts/alembic/env.py +73 -0
  35. remarkbox-0.0.1/remarkbox/scripts/alembic/script.py.mako +29 -0
  36. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/00211ed642cc_add_ip_address_column_to_rb_node.py +24 -0
  37. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/0208c10ea67f_create_new_node_cache_table.py +57 -0
  38. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/04e52337756e_autogenerated_indicies.py +38 -0
  39. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/051f8b810f26_namespace_ignore_query_string.py +26 -0
  40. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/1040ee4836af_namespace_description.py +26 -0
  41. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/14a6a35940c7_new_field_for_namespace_request_cache.py +33 -0
  42. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/184a349cd589_uri_accessed_timestamp.py +26 -0
  43. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/256468780798_root_nodes_to_namespace_.py +55 -0
  44. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/2e00b92495e4_node_disabled_timestamp.py +42 -0
  45. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/3ee195d142fb_add_subscription_type_to_namespace.py +32 -0
  46. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/40ded1163f95_add_user_surrogate_columns.py +25 -0
  47. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/43c1e5a99d4e_new_namespace_column_3.py +27 -0
  48. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/4aeda8e797ab_new_namespace_column_for_stylesheet_uris.py +32 -0
  49. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/503a2cef2378_root_stats.py +48 -0
  50. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/591800942adf_node_data_html_column.py +42 -0
  51. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/59592cf325fb_stylesheet_timestamp.py +26 -0
  52. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/5a5d0b68db78_add_root_id_field.py +40 -0
  53. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/6a440d3921d2_added_email_id_column_to_user_table.py +48 -0
  54. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/6bbc92ccc112_add_changed_column_to_node_table.py +31 -0
  55. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/6db39621f46c_namespace_group_conversations.py +24 -0
  56. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/6fc1d0cf350c_notification_columns_to_rb_user_table.py +52 -0
  57. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/76deff88cfd6_create_graph_depth_column_on_node_model.py +31 -0
  58. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/771ef7c868de_added_created_timestamp_column_to_.py +31 -0
  59. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/7a3a4755b4a8_add_hide_unless_approved_column.py +30 -0
  60. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/87fbd2b4e06e_namespace_theme_embed_column.py +26 -0
  61. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/8f76e372a953_password_attempts_field.py +28 -0
  62. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/953d42406dbb_namespace_public_column.py +24 -0
  63. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/98a90d2add21_namespace_model.py +36 -0
  64. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/98ced5f6ff36_stripe_id_for_user.py +26 -0
  65. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/a26302bcfa25_add_created_timestamp_column_to_oauth_.py +41 -0
  66. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/a38c12eeff2d_locked_rb_node.py +24 -0
  67. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/a738d6859f18_new_namespace_columns_2.py +37 -0
  68. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/aa2dfb4decda_hide_powered_by_column.py +26 -0
  69. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/b132ec968f0c_pay_what_you_can_table.py +33 -0
  70. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/ba8e83a3b8fd_namespace_stylesheet_embed_column.py +31 -0
  71. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/c9793937e756_make_all_verified_namespace_request_.py +38 -0
  72. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/c97ddfcbc406_approve_column.py +24 -0
  73. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/cbdf3cd4ccba_avatar_size_in_namespace.py +24 -0
  74. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/d1a0ab4f617f_add_has_uri_to_node.py +24 -0
  75. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/f5f88293428a_add_mathjax_column_to_rb_namespace.py +26 -0
  76. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/f7b42b2024fb_namespace_reverse_node_order.py +24 -0
  77. remarkbox-0.0.1/remarkbox/scripts/alembic/versions/fa8402aa1a00_add_link_protection_column_to_namespace.py +26 -0
  78. remarkbox-0.0.1/remarkbox/scripts/init_db.py +35 -0
  79. remarkbox-0.0.1/remarkbox/scripts/invalidate_node_cache.py +32 -0
  80. remarkbox-0.0.1/remarkbox/scripts/json_import.py +162 -0
  81. remarkbox-0.0.1/remarkbox/scripts/merge_dupes.py +49 -0
  82. remarkbox-0.0.1/remarkbox/scripts/modify_namespace.py +159 -0
  83. remarkbox-0.0.1/remarkbox/scripts/modify_node.py +176 -0
  84. remarkbox-0.0.1/remarkbox/scripts/modify_uris.py +55 -0
  85. remarkbox-0.0.1/remarkbox/scripts/modify_user.py +83 -0
  86. remarkbox-0.0.1/remarkbox/scripts/recompute_node_depths.py +21 -0
  87. remarkbox-0.0.1/remarkbox/scripts/safe_approve_all_nodes.py +29 -0
  88. remarkbox-0.0.1/remarkbox/scripts/send_node_digest_notifications.py +19 -0
  89. remarkbox-0.0.1/remarkbox/static/css/common.css +784 -0
  90. remarkbox-0.0.1/remarkbox/static/css/embed.css +38 -0
  91. remarkbox-0.0.1/remarkbox/static/css/pygments.css +61 -0
  92. remarkbox-0.0.1/remarkbox/static/favicon.ico +0 -0
  93. remarkbox-0.0.1/remarkbox/static/img/remarkbox-logo.png +0 -0
  94. remarkbox-0.0.1/remarkbox/static/img/remarkbox-minified.png +0 -0
  95. remarkbox-0.0.1/remarkbox/static/js/custom.js +93 -0
  96. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/ie8.polyfils.map +1 -0
  97. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/ie8.polyfils.min.js +4 -0
  98. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.js +1106 -0
  99. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.map +1 -0
  100. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js +10 -0
  101. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/iframeResizer.js +1040 -0
  102. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/iframeResizer.map +1 -0
  103. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/iframeResizer.min.js +9 -0
  104. remarkbox-0.0.1/remarkbox/static/js/iframe-resizer/index.js +2 -0
  105. remarkbox-0.0.1/remarkbox/static/js/jquery-2.1.3.min.js +4 -0
  106. remarkbox-0.0.1/remarkbox/templates/base.j2 +85 -0
  107. remarkbox-0.0.1/remarkbox/templates/billing.j2 +44 -0
  108. remarkbox-0.0.1/remarkbox/templates/dynamic-remarkbox.css.j2 +29 -0
  109. remarkbox-0.0.1/remarkbox/templates/edit-node.j2 +29 -0
  110. remarkbox-0.0.1/remarkbox/templates/embed-iframe.txt.j2 +41 -0
  111. remarkbox-0.0.1/remarkbox/templates/home.j2 +121 -0
  112. remarkbox-0.0.1/remarkbox/templates/join-or-log-in.j2 +31 -0
  113. remarkbox-0.0.1/remarkbox/templates/list-namespace-owners.j2 +27 -0
  114. remarkbox-0.0.1/remarkbox/templates/list-namespace-requests.j2 +29 -0
  115. remarkbox-0.0.1/remarkbox/templates/list-nodes.j2 +59 -0
  116. remarkbox-0.0.1/remarkbox/templates/list-notifications.j2 +45 -0
  117. remarkbox-0.0.1/remarkbox/templates/mail_digest_html.j2 +32 -0
  118. remarkbox-0.0.1/remarkbox/templates/mail_digest_text.j2 +15 -0
  119. remarkbox-0.0.1/remarkbox/templates/mail_immediate_html.j2 +27 -0
  120. remarkbox-0.0.1/remarkbox/templates/mail_immediate_text.j2 +8 -0
  121. remarkbox-0.0.1/remarkbox/templates/mail_snippet_html.j2 +40 -0
  122. remarkbox-0.0.1/remarkbox/templates/mail_snippet_text.j2 +27 -0
  123. remarkbox-0.0.1/remarkbox/templates/namespace-settings.j2 +269 -0
  124. remarkbox-0.0.1/remarkbox/templates/new.j2 +14 -0
  125. remarkbox-0.0.1/remarkbox/templates/rss.xml.j2 +40 -0
  126. remarkbox-0.0.1/remarkbox/templates/setup-namespace.j2 +165 -0
  127. remarkbox-0.0.1/remarkbox/templates/show-count.j2 +15 -0
  128. remarkbox-0.0.1/remarkbox/templates/show-node.j2 +191 -0
  129. remarkbox-0.0.1/remarkbox/templates/sitemap.xml.j2 +11 -0
  130. remarkbox-0.0.1/remarkbox/templates/snippets/add-to-slack.j2 +7 -0
  131. remarkbox-0.0.1/remarkbox/templates/snippets/create.j2 +29 -0
  132. remarkbox-0.0.1/remarkbox/templates/snippets/csrf.j2 +3 -0
  133. remarkbox-0.0.1/remarkbox/templates/snippets/email.j2 +31 -0
  134. remarkbox-0.0.1/remarkbox/templates/snippets/flash-alerts.j2 +11 -0
  135. remarkbox-0.0.1/remarkbox/templates/snippets/forms.j2 +100 -0
  136. remarkbox-0.0.1/remarkbox/templates/snippets/google-analytics.j2 +12 -0
  137. remarkbox-0.0.1/remarkbox/templates/snippets/javascript-includes.j2 +29 -0
  138. remarkbox-0.0.1/remarkbox/templates/snippets/owner-key-comment.j2 +6 -0
  139. remarkbox-0.0.1/remarkbox/templates/snippets/phone-menu.j2 +41 -0
  140. remarkbox-0.0.1/remarkbox/templates/snippets/powered-by.j2 +9 -0
  141. remarkbox-0.0.1/remarkbox/templates/snippets/search.j2 +7 -0
  142. remarkbox-0.0.1/remarkbox/templates/snippets/snippets.j2 +272 -0
  143. remarkbox-0.0.1/remarkbox/templates/snippets/stripe.j2 +133 -0
  144. remarkbox-0.0.1/remarkbox/templates/snippets/stylesheet-includes.j2 +18 -0
  145. remarkbox-0.0.1/remarkbox/templates/snippets/submit.j2 +1 -0
  146. remarkbox-0.0.1/remarkbox/templates/update-card.j2 +23 -0
  147. remarkbox-0.0.1/remarkbox/templates/user-settings.j2 +98 -0
  148. remarkbox-0.0.1/remarkbox/templates/user-watching.j2 +75 -0
  149. remarkbox-0.0.1/remarkbox/templates/verification-challenge.j2 +36 -0
  150. remarkbox-0.0.1/remarkbox/views/__init__.py +131 -0
  151. remarkbox-0.0.1/remarkbox/views/authenticated/__init__.py +0 -0
  152. remarkbox-0.0.1/remarkbox/views/authenticated/authenticated.py +403 -0
  153. remarkbox-0.0.1/remarkbox/views/authenticated/lock.py +95 -0
  154. remarkbox-0.0.1/remarkbox/views/authenticated/notifications.py +44 -0
  155. remarkbox-0.0.1/remarkbox/views/authenticated/oauth.py +125 -0
  156. remarkbox-0.0.1/remarkbox/views/authenticated/stripe.py +94 -0
  157. remarkbox-0.0.1/remarkbox/views/authenticated/topsecret.py +80 -0
  158. remarkbox-0.0.1/remarkbox/views/authenticated/watch.py +94 -0
  159. remarkbox-0.0.1/remarkbox/views/authentication.py +135 -0
  160. remarkbox-0.0.1/remarkbox/views/list_nodes.py +206 -0
  161. remarkbox-0.0.1/remarkbox/views/misc.py +127 -0
  162. remarkbox-0.0.1/remarkbox/views/modify_node.py +100 -0
  163. remarkbox-0.0.1/remarkbox/views/new_thread.py +93 -0
  164. remarkbox-0.0.1/remarkbox/views/reply_node.py +133 -0
  165. remarkbox-0.0.1/remarkbox.egg-info/PKG-INFO +290 -0
  166. remarkbox-0.0.1/remarkbox.egg-info/SOURCES.txt +177 -0
  167. remarkbox-0.0.1/remarkbox.egg-info/dependency_links.txt +1 -0
  168. remarkbox-0.0.1/remarkbox.egg-info/entry_points.txt +16 -0
  169. remarkbox-0.0.1/remarkbox.egg-info/not-zip-safe +1 -0
  170. remarkbox-0.0.1/remarkbox.egg-info/top_level.txt +1 -0
  171. remarkbox-0.0.1/requirements-dev.txt +6 -0
  172. remarkbox-0.0.1/requirements-prod.txt +5 -0
  173. remarkbox-0.0.1/requirements-test.txt +6 -0
  174. remarkbox-0.0.1/requirements-wsl.txt +79 -0
  175. remarkbox-0.0.1/requirements.py3.txt +72 -0
  176. remarkbox-0.0.1/requirements.txt +75 -0
  177. remarkbox-0.0.1/setup.cfg +4 -0
  178. remarkbox-0.0.1/setup.py +52 -0
  179. remarkbox-0.0.1/test.ini +140 -0
@@ -0,0 +1,2 @@
1
+ include *.txt *.ini *.cfg *.rst
2
+ recursive-include remarkbox *.ico *.png *.css *.gif *.jpg *.pt *.txt *.mak *.mako *.js *.html *.xml *.j2 *.map
@@ -0,0 +1,290 @@
1
+ Metadata-Version: 2.1
2
+ Name: remarkbox
3
+ Version: 0.0.1
4
+ Summary: remarkbox
5
+ Home-page: https://russell.ballestrini.net
6
+ Author: Russell Ballestrini
7
+ Author-email: russell@ballestrini.net
8
+ Keywords: remarkbox question answer forum embed comments reviews
9
+ Classifier: Programming Language :: Python
10
+ Classifier: Framework :: Pyramid
11
+ Classifier: Topic :: Internet :: WWW/HTTP
12
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
13
+
14
+ Remarkbox
15
+ #########
16
+
17
+ What is RemarkBox?:
18
+ A stand alone question and answer site (forum) or an embedded comments or product reviews service.
19
+ Works anywhere that supports HTML.
20
+
21
+ Original Developer:
22
+ Russell Ballestrini (https://russell.ballestrini.net)
23
+
24
+ Project Goals
25
+ =============
26
+
27
+ Note:
28
+ These goals are not in priority order.
29
+
30
+ #. To be a suitable for:
31
+
32
+ * question and answer sites (StackOverflow)
33
+ * embedded comment system for static sites
34
+ * forums
35
+ * product review sections of e-commerce sites
36
+
37
+ |
38
+
39
+ #. To choose popular libraries instead of proper libraries, for example:
40
+
41
+ * Github over Bitbucket (seriously considering GitLab)
42
+ * Git over HG Mercurial
43
+ * Jinja2 templates over Mako templates
44
+ * Markdown over ReStructuredText
45
+ * etc
46
+
47
+ |
48
+
49
+ Basically I have been burned too many times trying to pick the proper
50
+ library or tool for the job, so this time around, I will make effort
51
+ to choose solutions that the majority uses.
52
+
53
+ #. To be popular
54
+
55
+ #. To be safe from spammers
56
+
57
+ #. To be easy to manage and clean up spam if it happens
58
+
59
+ #. To be passwordless. Registration, verification and authentication happen via one-time-password codes sent via email.
60
+
61
+ #. To scale horizontally
62
+
63
+ #. To be multitenant
64
+
65
+ #. To have low friction for new users to join (posters and commenters)
66
+
67
+ #. To be engaging for users (posters and commenters)
68
+
69
+ #. To be search engine optimized
70
+
71
+ #. To have great test coverage
72
+
73
+
74
+ Local Installation
75
+ ==================
76
+
77
+ We utilize a ``Makefile`` to capture targets for building a local Remarkbox environment. Please make sure you have ``make`` installed.
78
+
79
+ #. ``make dev``
80
+ #. ``make test``
81
+
82
+ ## For WSL Users
83
+
84
+ If you are using Windows Subsystem for Linux (WSL), follow these steps to set up your environment:
85
+
86
+ Activate the virtual environment
87
+
88
+ .. code-block:: bash
89
+
90
+ source env/bin/activate
91
+
92
+ Install dependencies:
93
+
94
+ .. code-block:: bash
95
+
96
+ pip install -r requirements-wsl.txt
97
+
98
+
99
+ ### For Other Users
100
+
101
+ For users on other platforms, follow these steps:
102
+
103
+ Activate the virtual environment:
104
+
105
+ .. code-block:: bash
106
+
107
+ source env/bin/activate
108
+
109
+ Install dependencies:
110
+
111
+ .. code-block:: bash
112
+
113
+ pip install -r requirements.txt
114
+
115
+
116
+
117
+ Functional testing environment
118
+ -------------------------------
119
+
120
+ To setup a "functional testing" environment on your personal workstation, open two terminal shells.
121
+
122
+ In the first shell, run a copy of Remarkbox using:
123
+
124
+ .. code-block:: bash
125
+
126
+ make serve
127
+
128
+ In the second shell, run a "mock" simple HTTP web server to serve index.html:
129
+
130
+ .. code-block:: bash
131
+
132
+ make http
133
+
134
+ Now browse to http://127.0.0.1:8000 and index.html will load.
135
+ This has an embedded copy of Remarkbox which is also running on localhost.
136
+
137
+ If you attempt to log in, a verification one-time-password code will be sent over SMTP to log in!
138
+ If you do not have an SMTP server the socket error will log email to console when in development.
139
+
140
+
141
+ New Environments
142
+ ================
143
+
144
+ If your deployment is brand new, you don't need to run any migrations.
145
+
146
+ To create all the schemas & tables in your database, run these steps:
147
+
148
+ Activate the virtual environment:
149
+
150
+ .. code-block:: bash
151
+
152
+ source env/bin/activate
153
+
154
+ Create all the schemas & tables in your database
155
+
156
+ .. code-block:: bash
157
+
158
+ env/bin/remarkbox_init_db development.ini
159
+
160
+ You should however run this to stamp the database as ready:
161
+
162
+ .. code-block:: bash
163
+
164
+ alembic -c development.ini stamp head
165
+
166
+
167
+ SQL Migrations
168
+ ===============
169
+
170
+ Otherwise, it should be safe to run this at anytime to catch your database up:
171
+
172
+ .. code-block:: bash
173
+
174
+ alembic -c development.ini upgrade head
175
+
176
+ To look at the current revision and the history run these:
177
+
178
+ .. code-block:: bash
179
+
180
+ alembic -c development.ini history
181
+ alembic -c development.ini current
182
+
183
+ If you ever want to cut a new migration script, you can run this:
184
+
185
+ .. code-block:: bash
186
+
187
+ alembic -c development.ini revision -m "Added email_id column to User table."
188
+
189
+ Then you can edit / modify the generated ``.py`` file with your changes.
190
+
191
+ You can also autogenerate a new migration script using `--autogenerate`.
192
+ Alembic will prepare a migration script by comparing the state of the
193
+ database with the state of the model:
194
+
195
+ .. code-block:: bash
196
+
197
+ alembic -c development.ini revision --autogenerate -m "autogenerated indices."
198
+
199
+ You should review the recommended migration script before `upgrade`.
200
+
201
+
202
+ Cleaning the homepage
203
+ ========================
204
+
205
+ Sometimes (all the times) it's nice to clear all the test comments from
206
+ the homepage of our marketing site. Use this query.
207
+
208
+ .. code-block:: sql
209
+
210
+ sqlite> UPDATE rb_uri SET data = "https://www.remarkbox.com/?cleaned=2018-09-28" WHERE data = "https://www.remarkbox.com/";
211
+
212
+ sqlite> SELECT * FROM rb_uri WHERE data LIKE "%https://www.remarkbox.com/?cleaned%";
213
+ 1e631dd85d104555b41b300961d2f909|82008b2b178f4daab64c35ab5c5f9b56|https://www.remarkbox.com/?cleaned=2017-11-01
214
+ 6b2a4772679611e8ad95040140774501|6b2a42ae679611e8ad95040140774501|https://www.remarkbox.com/?cleaned=2018-09-28
215
+
216
+
217
+
218
+ Looking up paying customers
219
+ ==============================
220
+
221
+ .. code-block:: sql
222
+
223
+
224
+ SELECT * FROM rb_pay_what_you_can
225
+ INNER JOIN rb_user ON rb_user.id = rb_pay_what_you_can.user_id
226
+ WHERE amount > 0 and rb_user.stripe_id is not null;
227
+
228
+
229
+
230
+ Python Pyramid Shell
231
+ ==========================
232
+
233
+ If you want to use an interactive Python interpreter to interact with the Remarkbox app/models and database:
234
+
235
+ .. code-block:: bash
236
+
237
+ pshell development.ini
238
+
239
+ Here is a full `pshell` script to modify every `Node` who has a `Uri`:
240
+
241
+ .. code-block:: python
242
+
243
+ # begin the database transaction.
244
+ request.tm.begin()
245
+
246
+ # get all Uri objects.
247
+ uris = m.uri.get_all_uris(request.dbsession)
248
+
249
+ # iterate over all Uri objects.
250
+ for uri in uris:
251
+ # modify the Uri's related Node.
252
+ uri.node.has_uri = True
253
+ # add the related Node object to the sqlalchemy session.
254
+ request.dbsession.add(uri.node)
255
+
256
+ # flush / commit all changes stored the sqlalchemy session.
257
+ request.dbsession.flush()
258
+
259
+ # commit/close the database transaction to really make changes.
260
+ request.tm.commit()
261
+
262
+ Contributing
263
+ ===================
264
+
265
+ * Establish communication with Russell or another admin to bless your git.unturf.com gitlab account & put you into the proper roles.
266
+ * Russell should see your account request but due to spam you have to ask him directly for approval via email or some other means of comms.
267
+ * Clone repo & make commits
268
+ * Create merge requests, we automatically run the unit & headless functional tests on each commit
269
+ * On merge we release to the production site & see the change across users.
270
+
271
+ Optionally, format your code.
272
+
273
+ This is not set in stone, but if you want to use a formatter this is the path for now!
274
+
275
+ **Python**
276
+ black (manual)
277
+
278
+ **Jinja2**
279
+ None (not needed, neither is an HTML formatter)
280
+
281
+ **JavaScript**
282
+ Prettier or biome (manual)
283
+
284
+ **CSS**
285
+ Prettier or biome (manual)
286
+
287
+ Licence
288
+ =====================
289
+
290
+ All code contributed goes into the public domain.
@@ -0,0 +1,277 @@
1
+ Remarkbox
2
+ #########
3
+
4
+ What is RemarkBox?:
5
+ A stand alone question and answer site (forum) or an embedded comments or product reviews service.
6
+ Works anywhere that supports HTML.
7
+
8
+ Original Developer:
9
+ Russell Ballestrini (https://russell.ballestrini.net)
10
+
11
+ Project Goals
12
+ =============
13
+
14
+ Note:
15
+ These goals are not in priority order.
16
+
17
+ #. To be a suitable for:
18
+
19
+ * question and answer sites (StackOverflow)
20
+ * embedded comment system for static sites
21
+ * forums
22
+ * product review sections of e-commerce sites
23
+
24
+ |
25
+
26
+ #. To choose popular libraries instead of proper libraries, for example:
27
+
28
+ * Github over Bitbucket (seriously considering GitLab)
29
+ * Git over HG Mercurial
30
+ * Jinja2 templates over Mako templates
31
+ * Markdown over ReStructuredText
32
+ * etc
33
+
34
+ |
35
+
36
+ Basically I have been burned too many times trying to pick the proper
37
+ library or tool for the job, so this time around, I will make effort
38
+ to choose solutions that the majority uses.
39
+
40
+ #. To be popular
41
+
42
+ #. To be safe from spammers
43
+
44
+ #. To be easy to manage and clean up spam if it happens
45
+
46
+ #. To be passwordless. Registration, verification and authentication happen via one-time-password codes sent via email.
47
+
48
+ #. To scale horizontally
49
+
50
+ #. To be multitenant
51
+
52
+ #. To have low friction for new users to join (posters and commenters)
53
+
54
+ #. To be engaging for users (posters and commenters)
55
+
56
+ #. To be search engine optimized
57
+
58
+ #. To have great test coverage
59
+
60
+
61
+ Local Installation
62
+ ==================
63
+
64
+ We utilize a ``Makefile`` to capture targets for building a local Remarkbox environment. Please make sure you have ``make`` installed.
65
+
66
+ #. ``make dev``
67
+ #. ``make test``
68
+
69
+ ## For WSL Users
70
+
71
+ If you are using Windows Subsystem for Linux (WSL), follow these steps to set up your environment:
72
+
73
+ Activate the virtual environment
74
+
75
+ .. code-block:: bash
76
+
77
+ source env/bin/activate
78
+
79
+ Install dependencies:
80
+
81
+ .. code-block:: bash
82
+
83
+ pip install -r requirements-wsl.txt
84
+
85
+
86
+ ### For Other Users
87
+
88
+ For users on other platforms, follow these steps:
89
+
90
+ Activate the virtual environment:
91
+
92
+ .. code-block:: bash
93
+
94
+ source env/bin/activate
95
+
96
+ Install dependencies:
97
+
98
+ .. code-block:: bash
99
+
100
+ pip install -r requirements.txt
101
+
102
+
103
+
104
+ Functional testing environment
105
+ -------------------------------
106
+
107
+ To setup a "functional testing" environment on your personal workstation, open two terminal shells.
108
+
109
+ In the first shell, run a copy of Remarkbox using:
110
+
111
+ .. code-block:: bash
112
+
113
+ make serve
114
+
115
+ In the second shell, run a "mock" simple HTTP web server to serve index.html:
116
+
117
+ .. code-block:: bash
118
+
119
+ make http
120
+
121
+ Now browse to http://127.0.0.1:8000 and index.html will load.
122
+ This has an embedded copy of Remarkbox which is also running on localhost.
123
+
124
+ If you attempt to log in, a verification one-time-password code will be sent over SMTP to log in!
125
+ If you do not have an SMTP server the socket error will log email to console when in development.
126
+
127
+
128
+ New Environments
129
+ ================
130
+
131
+ If your deployment is brand new, you don't need to run any migrations.
132
+
133
+ To create all the schemas & tables in your database, run these steps:
134
+
135
+ Activate the virtual environment:
136
+
137
+ .. code-block:: bash
138
+
139
+ source env/bin/activate
140
+
141
+ Create all the schemas & tables in your database
142
+
143
+ .. code-block:: bash
144
+
145
+ env/bin/remarkbox_init_db development.ini
146
+
147
+ You should however run this to stamp the database as ready:
148
+
149
+ .. code-block:: bash
150
+
151
+ alembic -c development.ini stamp head
152
+
153
+
154
+ SQL Migrations
155
+ ===============
156
+
157
+ Otherwise, it should be safe to run this at anytime to catch your database up:
158
+
159
+ .. code-block:: bash
160
+
161
+ alembic -c development.ini upgrade head
162
+
163
+ To look at the current revision and the history run these:
164
+
165
+ .. code-block:: bash
166
+
167
+ alembic -c development.ini history
168
+ alembic -c development.ini current
169
+
170
+ If you ever want to cut a new migration script, you can run this:
171
+
172
+ .. code-block:: bash
173
+
174
+ alembic -c development.ini revision -m "Added email_id column to User table."
175
+
176
+ Then you can edit / modify the generated ``.py`` file with your changes.
177
+
178
+ You can also autogenerate a new migration script using `--autogenerate`.
179
+ Alembic will prepare a migration script by comparing the state of the
180
+ database with the state of the model:
181
+
182
+ .. code-block:: bash
183
+
184
+ alembic -c development.ini revision --autogenerate -m "autogenerated indices."
185
+
186
+ You should review the recommended migration script before `upgrade`.
187
+
188
+
189
+ Cleaning the homepage
190
+ ========================
191
+
192
+ Sometimes (all the times) it's nice to clear all the test comments from
193
+ the homepage of our marketing site. Use this query.
194
+
195
+ .. code-block:: sql
196
+
197
+ sqlite> UPDATE rb_uri SET data = "https://www.remarkbox.com/?cleaned=2018-09-28" WHERE data = "https://www.remarkbox.com/";
198
+
199
+ sqlite> SELECT * FROM rb_uri WHERE data LIKE "%https://www.remarkbox.com/?cleaned%";
200
+ 1e631dd85d104555b41b300961d2f909|82008b2b178f4daab64c35ab5c5f9b56|https://www.remarkbox.com/?cleaned=2017-11-01
201
+ 6b2a4772679611e8ad95040140774501|6b2a42ae679611e8ad95040140774501|https://www.remarkbox.com/?cleaned=2018-09-28
202
+
203
+
204
+
205
+ Looking up paying customers
206
+ ==============================
207
+
208
+ .. code-block:: sql
209
+
210
+
211
+ SELECT * FROM rb_pay_what_you_can
212
+ INNER JOIN rb_user ON rb_user.id = rb_pay_what_you_can.user_id
213
+ WHERE amount > 0 and rb_user.stripe_id is not null;
214
+
215
+
216
+
217
+ Python Pyramid Shell
218
+ ==========================
219
+
220
+ If you want to use an interactive Python interpreter to interact with the Remarkbox app/models and database:
221
+
222
+ .. code-block:: bash
223
+
224
+ pshell development.ini
225
+
226
+ Here is a full `pshell` script to modify every `Node` who has a `Uri`:
227
+
228
+ .. code-block:: python
229
+
230
+ # begin the database transaction.
231
+ request.tm.begin()
232
+
233
+ # get all Uri objects.
234
+ uris = m.uri.get_all_uris(request.dbsession)
235
+
236
+ # iterate over all Uri objects.
237
+ for uri in uris:
238
+ # modify the Uri's related Node.
239
+ uri.node.has_uri = True
240
+ # add the related Node object to the sqlalchemy session.
241
+ request.dbsession.add(uri.node)
242
+
243
+ # flush / commit all changes stored the sqlalchemy session.
244
+ request.dbsession.flush()
245
+
246
+ # commit/close the database transaction to really make changes.
247
+ request.tm.commit()
248
+
249
+ Contributing
250
+ ===================
251
+
252
+ * Establish communication with Russell or another admin to bless your git.unturf.com gitlab account & put you into the proper roles.
253
+ * Russell should see your account request but due to spam you have to ask him directly for approval via email or some other means of comms.
254
+ * Clone repo & make commits
255
+ * Create merge requests, we automatically run the unit & headless functional tests on each commit
256
+ * On merge we release to the production site & see the change across users.
257
+
258
+ Optionally, format your code.
259
+
260
+ This is not set in stone, but if you want to use a formatter this is the path for now!
261
+
262
+ **Python**
263
+ black (manual)
264
+
265
+ **Jinja2**
266
+ None (not needed, neither is an HTML formatter)
267
+
268
+ **JavaScript**
269
+ Prettier or biome (manual)
270
+
271
+ **CSS**
272
+ Prettier or biome (manual)
273
+
274
+ Licence
275
+ =====================
276
+
277
+ All code contributed goes into the public domain.
@@ -0,0 +1,155 @@
1
+ # Config File Reference:
2
+ # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
3
+
4
+ [alembic]
5
+ script_location = remarkbox:scripts/alembic
6
+ sqlalchemy.url = sqlite:///%(here)s/remarkbox.sqlite
7
+
8
+ [app:main]
9
+ use = egg:remarkbox
10
+
11
+ #sqlalchemy.url = postgres://localhost/remarkbox
12
+ sqlalchemy.url = sqlite:///%(here)s/remarkbox.sqlite
13
+
14
+ ###
15
+ # Pyramid configuration.
16
+ ###
17
+ pyramid.reload_templates = true
18
+ pyramid.debug_authorization = false
19
+ pyramid.debug_notfound = false
20
+ pyramid.debug_routematch = false
21
+ pyramid.default_locale_name = en
22
+ pyramid.includes =
23
+ pyramid_debugtoolbar
24
+ pyramid_tm
25
+
26
+ # By default, the toolbar only appears for clients from IP addresses
27
+ # '127.0.0.1' and '::1'.
28
+ # debugtoolbar.hosts = 127.0.0.1 ::1
29
+
30
+ ###
31
+ # session / cookie configuration.
32
+ # http://docs.pylonsproject.org/docs/pyramid/en/latest/api/session.html
33
+ ###
34
+ session.hashalg = sha512
35
+ session.secret = test-secret
36
+ session.timeout = 31104000
37
+ session.max_age = 31104000
38
+ session.reissue_time = 15552000
39
+ session.samesite = none
40
+ session.secure = False
41
+
42
+ ###
43
+ # custom app configuration.
44
+ ###
45
+ app.avatar.size = 35
46
+
47
+ # In prod I set this to: remarkbox.com (default = "")
48
+ #app.root_domain =
49
+ app.root_domain = ${REMARKBOX_APP_ROOT_DOMAIN}
50
+
51
+ # If set we force all links related to `join or log in` to this base url
52
+ # and use this url for links in email notifications.
53
+ # Also useful when multiple subdomains point at the same Remarkbox cluster.
54
+ # In prod I set this to: https://my.remarkbox.com (default = request.host_url)
55
+ #app.app_url =
56
+ app.app_url = ${REMARKBOX_APP_URL}
57
+
58
+ # if your marketing / main landing page base url is different then app url.
59
+ # In prod I set this to: https://www.remarkbox.com (default = request.app_url)
60
+ #app.marketing_url =
61
+
62
+ # if Node is None, we may safely redirect to this uri. optional.
63
+ #app.safe_redirect = https://www.remarkbox.com
64
+
65
+ app.email.relay = localhost
66
+ app.email.sender = no-reply@remarkbox.com
67
+
68
+ # set this to the path of your private DKIM key.
69
+ # reference: https://russell.ballestrini.net/quickstart-to-dkim-signed-email-with-python/
70
+ #app.email.dkim_private_key_path =
71
+ #app.email.dkim_selector =
72
+
73
+ # The app name in the email subject (default = request.app_domain)
74
+ # In production I set this to "Remarkbox".
75
+ app.email.subject_postfix = Remarkbox
76
+
77
+ # optional theme plugin name.
78
+ #app.theme = westworld
79
+ app.theme = meta
80
+
81
+ # optional theme plugin name for embed mode.
82
+ #app.theme_embed = meta
83
+
84
+ # stand-alone mode disables a bunch of views and templates
85
+ # related to billing and registering Namespaces.
86
+ # choices enabled or disabled. defaults to disabled.
87
+ #app.stand_alone_mode = disabled
88
+
89
+ # stripe: credit card storage and processing.
90
+ # This syntax will automatically expand an ENV var of the same name.
91
+ app.stripe.secret = ${REMARKBOX_APP_STRIPE_SECRET}
92
+ app.stripe.public = ${REMARKBOX_APP_STRIPE_PUBLIC}
93
+
94
+ # slack: bot notifications.
95
+ app.slack.secret = ${REMARKBOX_APP_SLACK_SECRET}
96
+ app.slack.public = ${REMARKBOX_APP_SLACK_PUBLIC}
97
+ app.slack.oauth_scope = channels:read,chat:write:bot
98
+
99
+ # feature flag for email notifications.
100
+ #app.deliver_email_notifications = true
101
+
102
+ # robots.txt contents.
103
+ #app.robots_dot_txt =
104
+ # User-agent: *
105
+ # Disallow:
106
+
107
+ ###
108
+ # wsgi server configuration
109
+ ###
110
+ [server:main]
111
+ use = egg:waitress#main
112
+ host = 0.0.0.0
113
+ port = 6543
114
+
115
+ ###
116
+ # logging configuration
117
+ # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
118
+ ###
119
+ [loggers]
120
+ keys = root, remarkbox, sqlalchemy
121
+
122
+ [handlers]
123
+ keys = console
124
+
125
+ [formatters]
126
+ keys = generic
127
+
128
+ [logger_root]
129
+ level = INFO
130
+ handlers = console
131
+
132
+ [logger_remarkbox]
133
+ level = DEBUG
134
+ handlers =
135
+ qualname = remarkbox
136
+
137
+ [logger_sqlalchemy]
138
+ level = WARN
139
+ handlers =
140
+ qualname = sqlalchemy.engine
141
+ # "level = INFO" logs SQL queries.
142
+ # "level = DEBUG" logs SQL queries and results.
143
+ # "level = WARN" logs neither. (Recommended for production systems.)
144
+
145
+ [handler_console]
146
+ class = StreamHandler
147
+ args = (sys.stderr,)
148
+ level = NOTSET
149
+ formatter = generic
150
+
151
+ [formatter_generic]
152
+ format = %(asctime)s %(levelname)-5.5s [%(name)s][%(threadName)s] %(message)s
153
+
154
+ [pshell]
155
+ m = remarkbox.models