Commit Graph

323 Commits

Author SHA1 Message Date
Martin Zimmermann
5ce48de94a add POST request to get comment counts for multiple URLs
The old way via `GET /count?uri=...` still works, but is now deprecated
and might be removed in future releases.
The new way is much more efficient especially fore multiple listings.

The internal implemention is improvable though.
2014-03-25 18:50:21 +01:00
Martin Zimmermann
da782654b2 remove warning when SMTP is not configured as notifcation backend 2014-03-20 17:07:42 +01:00
Martin Zimmermann
e4ad81cde0 exit if no website(s) are configured and remove default host 2014-03-20 17:07:38 +01:00
Martin Zimmermann
d69bfc2511 fix visual update up/downvote 2014-03-20 16:32:28 +01:00
Martin Zimmermann
0b816a0677 store session-key in database (once generated on db creation), #74
Store a random session key used to sign and verify comment ownership
once the database is initialized, not on every application startup.

Currently fixed session keys in [general] session-key are migrated into
the database on startup. The configuration parser will notice you about
the change and suggest you to remove this option.
2014-03-20 16:32:25 +01:00
Martin Zimmermann
8f293ad435 configurable avatar colors
* data-isso-avatar-bg="#f0f0f0" sets the background color
* data-isso-avatar-fg="#0abf99 #5698c4 etc." sets up to 8 different
  forground colors
2014-03-10 22:02:13 +01:00
Martin Zimmermann
c6e9c7eee4 Revert "run tests without depending on an already installed instance"
Breaks CLI (and probably other modules that use `dist.version`):

    [*]~/d/isso:master> isso -c sample.cfg run
    Traceback (most recent call last):
    File "/home/.../dev/isso/bin/isso", line 9, in <module>
        load_entry_point('isso==0.8.dev0', 'console_scripts', 'isso')()
    File "/home/.../dev/isso/isso/__init__.py", line 198, in main
        parser.add_argument('--version', action='version', version='%(prog)s ' + dist.version)
    AttributeError: 'module' object has no attribute 'version

This reverts commit 4e5e8c44f7.
2014-03-09 15:30:33 +01:00
Martin Zimmermann
a94472d062 add BSD license header to crypto.py 2014-03-09 12:18:15 +01:00
eroen
4e5e8c44f7 run tests without depending on an already installed instance 2014-03-08 22:32:21 +01:00
Martin Zimmermann
83361fbdac improve "time from now" helper, based on moment.js
http://momentjs.com/docs/#/displaying/fromnow/
2014-03-06 12:05:51 +01:00
Martin Zimmermann
ffd5882810 Merge branch 'fix-time-ago', closes #69 2014-03-06 12:05:05 +01:00
Martin Zimmermann
9a678e4691 an attempt to address #69
Add a global-like object that stores the delta from server time and
client time in a list and use the resulting average to "correct"
utils.ago diffs.
2014-03-06 11:44:33 +01:00
Martin Zimmermann
8540d45fae cumtime is only available in Python 2.7.4 or later 2014-03-06 11:32:25 +01:00
Martin Zimmermann
772730dbcd fix make_app logic 2014-03-06 11:05:22 +01:00
Martin Zimmermann
c4b80ff702 make CORS middleware more generic to use 2014-03-04 15:40:21 +01:00
Martin Zimmermann
3b248b293f set SMTP timeout to 10 seconds and make it configurable, ref 9a735e8 2014-03-04 09:47:54 +01:00
Martin Zimmermann
72c38c2312 set day_diff to 0 if negative, related to #69 2014-03-03 23:47:26 +01:00
Martin Zimmermann
9a735e8eac initial SMTP connection now timeouts after 5 seconds, closes #70 2014-03-03 23:42:35 +01:00
Martin Zimmermann
9272e7390f Merge branch 'feature/configurable-markdown', closes #62 2014-02-18 17:36:09 +01:00
Martin Zimmermann
1b0a74e188 expand db path, closes #68 2014-02-18 17:34:14 +01:00
Martin Zimmermann
d93d77c8c7 refactor markup and sanitization code
This commit introduces a new configuration section [markup] to refine
Misaka's Markdown extensions (by default strikethrough, superscript and
autolink).

Furthermore, you can set custom HTML elements/attributes that are
allowed, e.g. to enable images, set

  [markup]
  allowed-elements = img
  allowed-attributes = src

The refactorization separates HTML sanitization from Markdown -> HTML
and allows to include new markup languages such as BB Code or
reStructuredText.
2014-02-18 16:59:51 +01:00
Martin Zimmermann
6071a85787 add Config.getlist method 2014-02-18 16:51:04 +01:00
Martin Zimmermann
3d9665b523 remove now obsolete Makefile 2014-02-03 11:00:11 +01:00
Martin Zimmermann
1c3c826ada replace requirejs-domready with a (self-made) HTML5 idiom, #51
This commit removes yet another dependency. The provided domready
function is compatible with IE9, Firefox and Safari/Chrome.

Inspired by:

* http://stackoverflow.com/a/15580098
* https://github.com/requirejs/domReady/blob/master/domReady.js
2014-02-03 10:54:54 +01:00
Martin Zimmermann
f3e5d8dc1c add support for html5lib==0.95, fixes #60
The python-html5lib package in Debian Wheezy does not support
`etree` as tree builder (called `simpletree` back then).
2014-01-30 20:49:11 +01:00
Martin Zimmermann
14a2f82134 s/tls/starttls/ 2014-01-26 18:35:52 +01:00
Jocelyn Delande
cbf63f5a4e default smtp to port=587 and security=starttls 2014-01-26 17:17:09 +01:00
Martin Zimmermann
baff120800 fix french pluralform 2014-01-25 22:19:59 +01:00
Martin Zimmermann
cbd449dcd0 Merge branch 'transifex' 2014-01-16 12:01:04 +01:00
Martin Zimmermann
3a1f92b8bd use html5lib's sanitizer, supersedes 3713d5e
Python's HTMLParser is smart enough to filter malicious tags but fails
to repair invalid, user-inputted HTML. Instead of re-inventing the
wheel, Isso now uses html5lib's HTMLSanitizer with a whitelist of all
tags generated by Sundown.

Disallowed tags are discarded from the output to match the previous
unittests. This feature is only available for html5lib 0.99(9) and
later. Earlier releases just escape disallowed tags.
2014-01-13 19:11:59 +01:00
Martin Zimmermann
3713d5e8ee allow raw HTML markup for a few (whitelisted) tags
To be compatible with comments from Disqus (and users unfamiliar with
Markdown), Misaka no longer disables user-inputted HTML, but the
generated HTML is now post-processed and all "unsafe" tags (not
possible with Markdown) are discarded.

Whitelist: p, a, pre, blockquote, h1-h6, em, sub, sup, del, ins, math,
           dl, ol, ul, li

This commit also removes an unnecessary newline generated by
Misaka/Sundown.
2014-01-12 14:44:39 +01:00
Martin Zimmermann
36d702c7bc proper use of Misaka's HTML render flags (fix malicious HTML injection)
This commit now sanitizes *all* HTML tags written by the user (also
prevents auto-link to "unsafe" web protocols and images) as intended.

Fortunately because of Sundown's typography support, it did not affect
JS injection, but custom style tags and iframes.

PS: thanks to the anonymous submitter of a comment including a style tag
for 24pt, red font ;-)
2014-01-12 12:58:24 +01:00
Martin Zimmermann
dcd473967b Merge branch 'remove-q-lib' 2014-01-07 14:36:06 +01:00
Martin Zimmermann
6006a12778 fix wrong logic when vote counter stays at zero (e.g. self-vote) 2014-01-07 14:29:51 +01:00
Martin Zimmermann
306d2d9f9e log 5xx errors
Also, fix console.log usage.
2014-01-07 14:28:12 +01:00
Martin Zimmermann
a29393ee3f replace kriskowal/q with 50 LoC homebrew implementation, part of #51
As a result, it is no longer possible to chain promises
(then().then().then(etc.)), but that is actually not an issue for Isso.

The deferred/promise implementation is roughly based on
http://stackoverflow.com/a/17722683 and stackp/promisejs.
2014-01-07 14:28:10 +01:00
Martin Zimmermann
bfae158bde update translations from Transifex (initial pull) 2014-01-06 18:21:30 +01:00
Martin Zimmermann
9dd066c6a6 reflect security = ... in docs and print warning if used 2014-01-01 22:20:00 +01:00
Chimo
658e065f23 Adds STARTTLS support to SMTP notifications 2013-12-19 23:36:06 -05:00
Martin Zimmermann
85e637d017 simplify JSON response 2013-12-19 08:56:14 +01:00
Martin Zimmermann
905bd63eee CORS middleware must return bytes 2013-12-19 08:55:53 +01:00
Martin Zimmermann
82da63a81b check if hash is a base-16 string 2013-12-19 08:55:06 +01:00
Martin Zimmermann
e244227f41 convert proxy object to string before passing to urllib 2013-12-19 08:09:09 +01:00
Martin Zimmermann
cbee3f7b2e clarify copyright headers 2013-12-18 16:21:35 +01:00
Martin Zimmermann
a728d3e32d add doctest for IPv6 mapped IPv4 addresses 2013-12-18 13:08:57 +01:00
Martin Zimmermann
2a86b46893 add test for disqus import 2013-12-18 13:08:54 +01:00
Martin Zimmermann
f81b955aa5 use SHA1 instead of MD5 to verify comment owner 2013-12-18 13:01:09 +01:00
Martin Zimmermann
29a825b575 remove unused utility functions 2013-12-18 13:01:05 +01:00
Martin Zimmermann
65f260d0ba show session-key on application startup
Maybe useful to see that it really changes if unset. Also reduced key
size to 16 bytes form /dev/urandom (cosmetic reason, still enough).
2013-12-17 13:40:32 +01:00
Martin Zimmermann
a4213e4304 update docstrings for isso.db 2013-12-17 13:30:37 +01:00