Commit Graph

2646 Commits (3da4ed65862a2db14d39c103f93518018d2ffa88)

Author SHA1 Message Date
Joey Hess 3676ab329d sohrten url in subject 2015-05-19 17:44:20 -04:00
Joey Hess ba02e7f33d nicer layout of subject 2015-05-19 17:41:14 -04:00
Joey Hess 73e32f7fa6 add url to subject of email
The wikiname can be pretty un-helpful, the user will probably regognise the
url since they were just at it.
2015-05-19 17:38:15 -04:00
Joey Hess ab1bba9dab cloak user PII when making commits etc, and let cloaked PII be used in banned_users
This was needed due to emailauth, but I've also wrapped all IP address
exposure in cloak(), although the function doesn't yet cloak IP addresses.

(One IP address I didn't cloak is the one that appears on the password
reset email template. That is expected to be the user's own IP address,
so ok to show it to them.)

Thanks to smcv for the pointer to
http://xmlns.com/foaf/spec/#term_mbox_sha1sum
2015-05-14 11:58:21 -04:00
Joey Hess 85a529db3d passwordauth: Don't allow registering accounts that look like openids.
Also prohibit @ in account names, in case the file regexp was relaxed to
allow it.
2015-05-14 10:57:56 -04:00
Joey Hess 70cf5bb765 don't let emailauth user's email address be changed on preferences page
There's no real problem if they do change it, except they may get confused
and expect to be able to log in with the changed email and get the same
user account.
2015-05-13 23:32:29 -04:00
Joey Hess 7a68c4a01c when an emailauth user posts a comment, use the username only, not the full email address
This makes the email not be displayed on the wiki, so spammers won't find
it there.

Note that the full email address is still put into the comment template.
The email is also used as the username of the git commit message
(when posting comments or page edits). May want to revisit this later.
2015-05-13 23:26:22 -04:00
Joey Hess 497513e737 avoid showing password prefs for emailauth user 2015-05-13 23:24:07 -04:00
Joey Hess a7bd24b7b9 fix up session cookie 2015-05-13 23:06:52 -04:00
Joey Hess 95e1e51caa emailauth link sent and verified; user login works
Still some work to do since the user name is an email address and should
not be leaked.
2015-05-13 22:27:03 -04:00
Joey Hess 035c1a2449 move stub auth hook to loginselector 2015-05-13 18:54:13 -04:00
Joey Hess e34533d1a0 email auth plugin now works through email address entry 2015-05-13 18:50:40 -04:00
Joey Hess 5b459737a5 Converted openid-selector into a more generic loginselector helper plugin. 2015-05-13 18:50:29 -04:00
Joey Hess f8add0adb3 rename openid selector files to login-selector 2015-05-13 17:58:59 -04:00
Joey Hess 7765941011 further generalization of openid selector
Now template variables can be set to control which login methods are shown
2015-05-13 17:51:29 -04:00
Joey Hess ab4d9a5467 generalized the openid selector to a login selector
This includes some CSS changes to names of elements.

Also, added Email login button (doesn't work yet of course),
and brought back the small openid login buttons. Demoted yahoo and verison
to small buttons. This makes the big buttons be the main login types, and
the small buttons be provider-specific helpers.
2015-05-13 16:50:44 -04:00
Joey Hess ec72b4c95b When openid and passwordauth are the only enabled auth plugins, make the openid selector display "Password" instead of "Other", so users are more likely to click on it when they don't have an openid. 2015-05-13 12:18:22 -04:00
Simon McVittie a1fda0b516 Standardize on --long-option instead of -long-option
[[forum/refresh_and_setup]] indicates some confusion between --setup
and -setup. Both work, but it's clearer if we stick to one in
documentation and code.

A 2012 commit to [[plugins/theme]] claims that "-setup" is required
and "--setup" won't work, but I cannot find any evidence in ikiwiki's
source code that this has ever been the case.
2015-03-01 16:15:01 +00:00
Amitai Schlair 3a19663d48 In VCS-committed anonymous comments, link to url. 2015-01-08 08:11:40 -05:00
Amitai Schlair 0451dc4133 Update blogspam to the 2.0 API. 2015-01-02 13:55:10 -05:00
Joey Hess f88e109bec po: If msgmerge falls over on a problem po file, print a warning message, but don't let this problem crash ikiwiki entirely. 2014-12-30 15:51:50 -04:00
Amitai Schlair a87f43d71e Avoid uninitialized warnings with comments+no CGI. 2014-12-28 13:15:45 -05:00
Amitai Schlair 38a088a433 ikiwiki-comment: optionally override parameters. 2014-12-27 22:38:18 -05:00
Amitai Schlair b87e46a76d Squelch "keys on reference is experimental". 2014-12-27 16:55:12 -05:00
Simon McVittie 6c51b764bc Merge branch 'ready/html5' 2014-11-26 11:58:05 +00:00
Simon McVittie 1abf35e1b5 Fix numeric comparisons with undef 2014-11-26 11:29:14 +00:00
Simon McVittie 36f5e63d73 fix some typos 2014-11-26 09:23:24 +00:00
Simon McVittie 96566c33a7 Merge remote-tracking branch 'spalax/calendar-autocreate' 2014-11-26 09:13:44 +00:00
Louis 473bcbe7a4 Corrected error: month pages were created even without calendar_autocreate config option 2014-11-14 14:59:58 +01:00
Louis d0b3495124 Deleted unnecessary code 2014-11-14 12:52:51 +01:00
Louis 1d97160dae Indentation 2014-11-14 12:50:17 +01:00
Joey Hess ea8c7a7e02 openid: Stop suppressing the email field on the Preferences page.
This is needed for notifyemail, and not all openid providers report an
email address, or necessarily the one the user wants to get email.
2014-11-06 15:00:09 -04:00
Joey Hess 82a4fb49ae add ikiwiki-comment program 2014-10-20 12:08:07 -04:00
Amitai Schlair 305c91ccfb Remove space from perl shebang path. 2014-10-17 09:05:00 -04:00
Amitai Schlair 09e7c1ad99 IkiWiki::Plugin::openid: as a precaution, do not call non-coderefs
We're running under "use strict" here, so if CGI->param's array-context
misbehaviour passes an extra non-ref parameter, it shouldn't be executed
anyway... but it's as well to be safe.

[commit message added by smcv]
2014-10-16 22:24:48 +01:00
Amitai Schlair cfbcbda0ad Call CGI->param_fetch instead of CGI->param in array context
CGI->param has the misfeature that it is context-sensitive, and in
particular can expand to more than one scalar in function calls.
This led to a security vulnerability in Bugzilla, and recent versions
of CGI.pm will warn when it is used in this way.

In the situations where we do want to cope with more than one parameter
of the same name, CGI->param_fetch (which always returns an
array-reference) makes the intention clearer.

[commit message added by smcv]
2014-10-16 22:24:47 +01:00
Simon McVittie f4ec7b06d9 Make sure we do not pass multiple CGI parameters in function calls
When CGI->param is called in list context, such as in function
parameters, it expands to all the potentially multiple values
of the parameter: for instance, if we parse query string a=b&a=c&d=e
and call func($cgi->param('a')), that's equivalent to func('b', 'c').
Most of the functions we're calling do not expect that.

I do not believe this is an exploitable security vulnerability in
ikiwiki, but it was exploitable in Bugzilla.
2014-10-16 22:24:47 +01:00
Simon McVittie 490a1eca7b Always produce HTML5 doctype and new attributes, but not new elements
According to caniuse.com, a significant fraction of Web users are
still using Internet Explorer versions that do not support HTML5
sectioning elements. However, claiming we're XHTML 1.0 Strict
means we can't use features invented in the last 12 years, even if
they degrade gracefully in older browsers (like the role and placeholder
attributes).

This means our output is no longer valid according to any particular
DTD. Real browsers and other non-validator user-agents have never
cared about DTD compliance anyway, so I don't think this is a real loss.
2014-10-16 11:04:53 +01:00
Simon McVittie 17fccbca94 Do not pass ignored sid parameter to checksessionexpiry
checksessionexpiry's signature changed from
(CGI::Session, CGI->param('sid')) to (CGI, CGI::Session) in commit
985b229b, but editpage still passed the sid as a useless third
parameter, and this was later cargo-culted into remove, rename and
recentchanges.
2014-10-12 18:03:57 +01:00
Simon McVittie 4e2bfe1e17 comments: don't log remote IP address for signed-in users
The intention was that signed-in users (for instance via httpauth,
passwordauth or openid) are already adequately identified, but
there's nothing to indicate who an anonymous commenter is unless
their IP address is recorded.
2014-10-12 18:03:28 +01:00
Simon McVittie eb4945a3bc img: raise an error if we cannot find the image's size
This happens for PDFs without ghostscript installed, for instance.
2014-09-16 10:00:40 +01:00
Simon McVittie 7f5c2cfa5a Merge branch 'ready/templatebody' 2014-09-15 21:52:03 +01:00
Simon McVittie c1b80c54fa Merge branch 'ready/autoindex-more-often' 2014-09-15 21:23:18 +01:00
Simon McVittie ea2ab6f885 Merge branch 'ready/more-magic' 2014-09-15 21:08:40 +01:00
Simon McVittie e3e6ca2777 pagestats: rename disp to show, and document it 2014-09-14 15:57:09 +01:00
Simon McVittie 89492a62a7 pagestats: consistent indentation 2014-09-14 15:51:22 +01:00
Louis cd5a24d8b4 pagestats: add disp parameter 2014-09-14 15:49:38 +01:00
Simon McVittie ab768a62c6 Rename show parameter of [[!inline]] and [[!pagestats]] to limit
The old name still works, if its value is numeric.

This name allows a non-numeric "show" to mean the same thing
it does for [[!map]] (show title, show description, etc.).
2014-09-14 15:15:27 +01:00
Simon McVittie 9be3f95116 Merge branch 'ready/imgforpdf-and-more' 2014-09-12 21:59:00 +01:00
Simon McVittie 669a5f5ecc Merge branch 'ready/chrysn/linkmapenhancement' 2014-09-12 21:57:04 +01:00
Simon McVittie 390f12a845 Merge branch 'ready/edittemplate2' 2014-09-12 21:54:13 +01:00
Simon McVittie dadde570a1 Merge branch 'ready/postform-no' 2014-09-12 21:46:04 +01:00
Simon McVittie 252804628d Merge branch 'ready/perf' 2014-09-12 21:45:04 +01:00
Simon McVittie a55752a7be Merge branch 'ready/comments' 2014-09-12 21:40:24 +01:00
Simon McVittie 2eea320b67 Merge branch 'ready/trail-sort' 2014-09-12 21:38:06 +01:00
Simon McVittie 77a2267dcf filecheck: accept MIME types that don't contain ';' 2014-09-10 09:00:20 +01:00
Simon McVittie 26d62b386e edittemplate: use unambiguous RFC 3339 datestamps
These take into account the timezone offset (and convert it to UTC+0000)
rather than being in an unspecified timezone.
2014-09-01 09:01:07 +01:00
Simon McVittie 6806ddfdff Only provide time, not formatted_time, to edittemplate templates
I'm not sure what the use-case is for formatted_time, and chrysn
pointed out that for display in HTML, [[!date "<TMPL_VAR time>"]]
would be nicer.
2014-09-01 08:58:12 +01:00
Jonathon Anderson 9adee0a222 Provide the current time to edittemplate.
The `time` variable contains a fixed-format time, guaranteed suitable
for parsing by timedate.

The `formatted_time` variable contains the same time formatted by
IkiWiki::formattime.
2014-09-01 08:54:37 +01:00
Simon McVittie eb87dd177a Use Linux uuid facility instead of an external library if possible 2014-09-01 08:54:37 +01:00
Simon McVittie 4a11dc4d16 edittemplate: only generate a UUID on-demand
If the template doesn't use <TMPL_VAR UUID> there's no point in
incurring any cost.
2014-09-01 08:54:37 +01:00
Jonathon Anderson 7aa10a2952 Provide a UUID in edittemplate templates.
I want to make GUIDs for my RSS feeds that don't change when I move
pages around.  To that end, I've used UUID::Tiny to generate a
version 4 (random) UUID that is presented in a `uuid` variable in
the template.

At that point, you can do something like this:

    [[!meta guid="urn:uuid:<TMPL_VAR uuid>"]]
2014-09-01 08:54:37 +01:00
David Bremner adbc9cb8d6 Plugins::highlight: replace use of langdefdir with searchFile
In recent versions of highlight there can be more than one langdefdir.
This patch fixes the ensuing hilarity when the user adds a single
highlight lang definition and highlight.pm expects all definitions to
be in the same place.
2014-08-06 22:29:25 -03:00
David Bremner a55a20f5f8 cope with missing getConfDir in 3.18+ of highlight.
Unfortunately we have to try a couple things since the API changed
between 3.9 and 3.18
2014-08-06 22:28:32 -03:00
chrysn fa2a4d0db4 show resized img in preview using data: urls
in analogy to sparklines, this renders scaled imgs to
data:img/...;base64,... urls in preview mode.

if the image is already present on the server (eg because it was not
just inserted), the already rendered image is referenced instead.
2014-07-15 13:47:37 +02:00
chrysn a308b212ad img plugin: split resizing calculations and actual resizing
there is now a size calculating part (which chooses a final size) and a
scaling part (which triggers if the sizes calculated by the former
indicate a downscaling).

this solves the issue of unproportional upscalings
(bugs/image_rescaling_distorts_with_small_pictures).

also, "small" pdf files (or pdf files without explicit size settings),
which would not be converted under the old mechanism, now get rendered
to pngs.

this commit affects a unit test: while svgs were previously
unconditionally rendered to pngs, this now only happens on downscaling.
this is intentional -- while a small version of an svg graphic is
likely to be more compact when rendered (eg as a preview), a large
version would not have that benefit, and why convert something that
browsers basically can show and be inconsistend with how other images
are handled. the new unit test simply makes the original svg larger to
check for the same behaviros as before.
2014-07-15 13:44:22 +02:00
Simon McVittie 3f4a935740 trail: don't generate a costly dependency when forcing sort order
pagespec_match_list() makes the current page depend on the pagespec
being matched, so if you use [[!trailoptions sort="..."]] to force
a sort order, the trail ends up depending on internal(*) and is
rebuilt whenever anything changes. Add a new sort_pages() and use that
instead.
2014-07-11 22:08:08 +01:00
Louis f35b62d454 Calendar pages are now rebuilt when previous or next page have changed 2014-07-07 15:12:36 +02:00
Louis 492a22ac75 Making use of the transient plugin 2014-07-07 09:40:53 +02:00
Louis 59b46942e0 Added option `calendar_fill_gaps` 2014-07-05 14:14:57 +02:00
Louis 7f18c1ce48 Simplifying code
Thanks to review from http://ikiwiki.info/todo/calendar_autocreate/
2014-07-05 12:11:18 +02:00
Simon McVittie ef7c80258d comments: use comments_pagespec for authorization, not just UI 2014-07-04 23:27:43 +01:00
Simon McVittie 0357ad66ea inline: postform=no should take precedence over rootpage existing
If someone has explicitly disabled the postform, it seems reasonable
from a least-astonishment point of view for that to take precedence
over rootpage, even though that makes rootpage useless.

Also add a regression test; so far, this is all it tests.
2014-07-04 23:23:42 +01:00
Simon McVittie 17440ea301 Allow creation of transient index pages for directories outside srcdir
After this change autoindex creates index pages also for empty directories
included in underlays, but only if it isn't going to commit them to the
srcdir ($config{autoindex_commit} = 0).

Inspired by a patch from Tuomas Jormola.

Bug-Debian: http://bugs.debian.org/611068
2014-07-04 09:25:09 +01:00
Simon McVittie 3ba2ef1a54 autoindex: remove unnecessary special case for transient underlay
It's not clear that the transient underlay should be excluded from
indexing; see [[bugs/transient autocreated tagbase is not transient
autoindexed]].

In any case, the code that checks what directories might need indexes
specifically checks for the srcdir anyway, so the only effect this extra
check can have is negative (it could fail to notice files in the
transient underlay and attempt to recreate them unnecessarily).
2014-07-04 09:22:57 +01:00
Louis 2a5e8e72a0 calendar plugin: Autocreate archive pages if needed 2014-06-24 15:17:51 +02:00
chrysn bcc209eb5a add pagenumber parameter
this allows picking a page from a pdf. also, this enhances performance
greatly when rendering pdfs, as only the first page is rasterized.
(otherwise, imagemagick would treat the pdf as a list of images, work
with all of them, until finally only the first page gets saved). the
default parameter of 0 will select the single image contained in typical
image files anyway, so no specialcasing between single- and multifile
containers is needed.
2014-04-07 11:32:25 +02:00
chrysn 6cc43773e7 add pdf support to the img directive
this is trivial as pdf is supported by imagemagick, and just needs an
explicit mention to enable conversion.
2014-04-07 11:19:04 +02:00
chrysn 71b9ad33e0 set the file type parameter after reading the image
imagemagick, when reading an image, sets its magick parameter to
indicate the file type, overriding the explicitly set file type for
output if it is set at creation.

as a result, previously (with graphicsmagick-libmagick-dev-compat
1.3.18-1 providing Image::Magick), svg output files were not png,
neither svg, but mvg (imagemagick vector graphics).
2014-04-07 11:15:51 +02:00
Joey Hess 59cfb9b6d0 only_committed_changes could fail in a git repository merged with git merge -s ours. 2014-04-05 19:09:05 -04:00
Simon McVittie 7672014582 Add templatebody plugin and directive, and enable it by default
Also add a regression test for templatebody.
2014-03-05 10:42:19 +00:00
Simon McVittie 24599e3cc9 In all=no conditionals, depend on the influences, not the test pagespec
Previously, if a page like `plugins/trail` contained a conditional like

    [[!if test="backlink(plugins/goodstuff)" all=no]]

(which it gets via `templates/gitbranch`), then the
[[plugins/conditional]] plugin would give `plugins/trail` a dependency on
`(backlink(plugins/goodstuff)) and plugins/trail`. This dependency is
useless: that pagespec can never match any page other than
`plugins/trail`, but if `plugins/trail` has been modified or deleted,
then it's going to be rendered or deleted *anyway*, so there's no point
in spending time evaluating match_backlink for it.

Conversely, the influences from the result were not taken into account,
so `plugins/trail` did not have the
`{ "plugins/goodstuff" => $DEPEND_LINKS }` dependency that it should.

Invert that, depending on the influences but not on the test.

Bug: http://ikiwiki.info/bugs/editing_gitbranch_template_is_really_slow/
2014-03-03 11:30:36 +00:00
Joey Hess ddc9441beb Merge remote-tracking branch 'remotes/smcv/ready/careful-eval' 2014-02-23 14:21:13 -04:00
Joey Hess c1fbd66c03 Merge remote-tracking branch 'remotes/smcv/ready/git-push-origin-master' 2014-02-23 14:19:39 -04:00
Joey Hess 204dcda88b Merge remote-tracking branch 'intrigeri/fix_diffurl_vs._cgit' 2014-02-23 14:13:53 -04:00
Joey Hess 9a99c4c6e2 Merge remote-tracking branch 'mhameed/html_lang_and_dir' 2014-02-23 14:06:40 -04:00
Simon McVittie bb359796b8 protect $@ whenever a block using $@ is non-trivial
As noted in the Try::Tiny man page, eval/$@ can be quite awkward in
corner cases, because $@ has the same properties and problems as C's
errno. While writing a regression test for definetemplate
in which it couldn't find an appropriate template, I received

    <span class="error">Error: failed to process template
    <span class="createlink">deftmpl</span> </span>

instead of the intended

    <span class="error">Error: failed to process template
    <span class="createlink">deftmpl</span> template deftmpl not
    found</span>

which turned out to be because the "catch"-analogous block called
gettext before it used $@, and gettext can call define_gettext,
which uses eval.

This commit alters all current "catch"-like blocks that use $@, except
those that just do trivial things with $@ (string interpolation, string
concatenation) and call a function (die, error, print, etc.)
2014-02-21 17:06:36 +00:00
Simon McVittie be3483fe9b git: explicitly specify the branch to push to origin
git's behaviour when doing "git push origin" is configurable, and the
default is going to change in 2.0. In particular, if you've set
push.default to "nothing", the regression test will warn:

fatal: You didn't specify any refspecs to push, and push.default
is "nothing".
'git push origin' failed:  at .../lib/IkiWiki/Plugin/git.pm line 220.
2014-02-21 16:39:17 +00:00
Tuomas Jormola dc53ca18f2 Bug#737121: ikiwiki: [PATCH] Implement configuration option to set the user agent string for outbound HTTP requests
Package: ikiwiki
Version: 3.20140125
Severity: wishlist

By default, LWP::UserAgent used by IkiWiki to perform outbound HTTP
requests sends the string "libwww-perl/<version number>" as User-Agent
header in HTTP requests. Some blogging platforms have blacklisted the
user agent and won't serve any content for clients using this user agent
string. With IkiWiki configuration option "useragent" it's now possible
to define a custom string that is used for the value of the User-Agent
header.
2014-02-01 16:53:33 -04:00
Joey Hess a8d7a99979 osm: Escape name parameter. Closes: #731797 2014-01-15 15:53:51 -04:00
Joey Hess fe1a69e11a inline: Allow overriding the title of the feed. Closes: #735123 Thanks, Christophe Rhodes 2014-01-13 17:06:29 -04:00
intrigeri d52774dd45 Do not UTF8-escape "/" in Git's diffurl: cgit does not support this. 2013-12-31 01:47:10 +00:00
Joey Hess a2fb23286f aggregrate: Fix several bugs in handling of empty and colliding titles when generating filenames. 2013-12-28 20:02:22 -04:00
Joey Hess bfc13b9070 osm: Remove invalid use of charset on embedded javascript tags. Closes: #731197 2013-12-03 12:42:04 -04:00
Joey Hess 6d95bd7e02 typo 2013-11-18 16:35:51 -04:00
Joey Hess 002a97ffcd search: Added googlesearch option, which makes it search google rather than using the internal xapain database. (googlesearch plugin is too hard to turn on when xapain databases corrupt themselves, which happens all too frequently). 2013-11-17 16:37:18 -04:00
Joey Hess 81aa58e7ca comments: Write pending moderation comments to the transient underlay to avoid conflict with only_committed_changes. 2013-11-17 13:07:00 -04:00
Joey Hess e11a87acfa autoindex and tag use transient underlay when not committing, so do not need to disable only_committed_changes 2013-11-17 12:51:20 -04:00
Joey Hess 7dd110ba51 disable only_committed_changes when uncommitted files are created by plugins 2013-11-17 00:04:05 -04:00
Joey Hess 441002e3e6 deal with the case where oldrev is the same as newrev 2013-11-16 20:48:23 -04:00