aboutsummaryrefslogtreecommitdiffstats
path: root/ui-shared.c
Commit message (Expand)AuthorAgeFilesLines
* ui-shared: don't write <link> if favicon unset•••Since the favicon setting defaults to "/favicon.ico", the user can only unset it with favicon=. However, that would write an empty string as the config value. Previously, such empty string always satisfied the if condition. In this case it is better to omit the <link> entirely. Signed-off-by: Christian Barcenas <christian@cbarcenas.com> Signed-off-by: Christian Hesse <mail@eworm.de> Christian Barcenas2025-08-251-1/+1
* ui-tree: provide link to about page for pretty formatting•••We have an ongoing discussion about display filters and pretty formatting in tree view. How about providing a link to about page for pretty formatting? Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2025-08-181-0/+6
* git: update to v2.47.0•••Update to git version v2.47.0, this requires changes for these upstream commits: * e8207717f1623325fe1c95338fb03c1104ed5687 refs: add referent to each_ref_fn Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2024-10-071-2/+2
* git: update to v2.46.0•••Update to git version v2.46.0, this requires changes for these upstream commits: * e7da9385708accf518a80a1e17969020fb361048 global: introduce `USE_THE_REPOSITORY_VARIABLE` macro * 9da95bda74cf10e1475384a71fd20914c3b99784 hash: require hash algorithm in `oidread()` and `oidclr()` * 30aaff437fddd889ba429b50b96ea4c151c502c5 refs: pass repo when peeling objects * c8f815c2083c4b340d4148a15d45c55f2fcc7d3f refs: remove functions without ref store Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2024-08-021-2/+6
* git: update to v2.45.0•••Update to git version v2.45.0, this requires changes for these upstream commits: * 9720d23e8caf4adee44b3a32803a9bb0480118bd date: make DATE_MODE thread-safe Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2024-04-291-2/+2
* git: update to v2.41.0•••Update to git version v2.41.0, with lots of changes... This requires changes for these upstream commits: * 60ff56f50372c1498718938ef504e744fe011ffb banned.h: mark `strtok()` and `strtok_r()` as banned * 52acddf36c8cb3778ab2098a0d95cc2e375a4069 string-list: multi-delimiter `string_list_split_in_place()` * d850b7a545fcfbd97460a921c7f7c59d933eb0f7 cocci: apply the "cache.h" part of "the_repository.pending" * cb338c23d6d518947bf6f7240bf30e2ec232bd3b cocci: apply the "commit-reach.h" part of "the_repository.pending" * ecb5091fd4301ac647db0bd2504112b38f7ee06d cocci: apply the "commit.h" part of "the_repository.pending" * 085390328f5fe1dfba67039b1fd6cc51546a4e41 cocci: apply the "diff.h" part of "the_repository.pending" * bc726bd075929aab6b3e09d4dd5c2b0726fd5350 cocci: apply the "object-store.h" part of "the_repository.pending" * bab821646a74c446370fa8d01ca851f247df5033 cocci: apply the "pretty.h" part of "the_repository.pending" * afe27c889429438829bc8818ed17e4960bd3ef02 cocci: apply the "packfile.h" part of "the_repository.pending" * 12cb1c10a64170a5d600dd1c6c8abfeec105fb6b cocci: apply the "refs.h" part of "the_repository.pending" * 035c7de9e9ea11d26df5f9e4bb117f91ed11a9fd cocci: apply the "revision.h" part of "the_repository.pending" ... and some more I missed to list 😜 - for example the move and cleanup of headers and includes (see changes in `cgit.h`) comes to mind... Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2023-06-011-4/+4
* config: make empty js= omit script tag•••According to the cgitrc man page, an empty js= value should cause the script tag to be omitted. But instead, a script tag with an empty URL is emitted. The same applies to css. So, skip emitting a tag if the specified string is empty. Signed-off-by: Samuel Lidén Borell <samuel@kodafritt.se> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Samuel Lidén Borell2023-01-101-0/+8
* js: add dynamic age update•••This patch updates the emitted "ages" dynamically on the client side. After updating on completion of the document load, it sets a timer to update according to the smallest age it found. If there are any ages listed in minutes, then it will update again in 10s. When the most recent age is in hours, it updates every 5m. If days, then every 30m and so on. This keeps the cost of the dynamic updates at worst once per 10s. The updates are done entirely on the client side without contact with the server. To make this work reliably, since parsing datetimes is unreliable in browser js, the unix time is added as an attribute to all age spans. To make that reliable cross-platform, the unix time is treated as a uint64_t when it is formatted for printing. The rules for display conversion of the age is aligned with the existing server-side rules in ui-shared.h. If the client or server-side time are not synchronized by ntpd etc, ages shown on the client will not relate to the original ages computed at the server. The client updates the ages immediately when the DOM has finished loading, so in the case the times at the server and client are not aligned, this patch changes what the user sees on the page to reflect patch age compared to client time. If the server and client clocks are aligned, this patch makes no difference to what is seen on the page. Signed-off-by: Andy Green <andy@warmcat.com> Signed-off-by: Christian Hesse <mail@eworm.de> Andy Green2022-12-191-1/+1
* config: add js•••Just like the config allows setting css URL path, add a config for setting the js URL path Signed-off-by: Andy Green <andy@warmcat.com> Reviewed-by: John Keeping <john@keeping.me.uk> Signed-off-by: Christian Hesse <mail@eworm.de> Andy Green2022-12-191-0/+17
* css: change to be a list•••Without changing the default behaviour of including /cgit.css if nothing declared, allow the "css" config to be given multiple times listing one or more alternative URL paths to be included in the document head area. Signed-off-by: Andy Green <andy@warmcat.com> Signed-off-by: Christian Hesse <mail@eworm.de> Andy Green2022-12-191-3/+18
* ui-shared: use owner-filter for repo page headers•••Previously it was only used if owners were displayed on the index. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> June McEnroe2022-12-191-1/+7
* ui-repolist,ui-shared: remove redundant title on repo anchors•••The title attribute was being set to the same value as the anchor element text. Signed-off-by: Chris Mayo <aklhfex@gmail.com> Reviewed-by: Eric Wong <e@80x24.org> Reviewed-by: Petr Vorel <petr.vorel@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Chris Mayo2022-12-191-1/+1
* git: update to v2.30.0•••Update to git version v2.30.0, this requires changes for these upstream commits: * 88894aaeeae92e8cb41143cc2e045f50289dc790 blame: simplify 'setup_scoreboard' interface * 1fbfdf556f2abc708183caca53ae4e2881b46ae2 banned.h: mark non-reentrant gmtime, etc as banned Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2020-12-291-4/+5
* global: replace references to 'sha1' with 'oid'•••For some time now sha1 is considered broken and upstream is working to replace it with sha256. Replace all references to 'sha1' with 'oid', just as upstream does. Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2020-10-201-20/+20
* ui-shared: restrict to 15 levels•••Perhaps a more ideal version of this would be to not print breadcrumbs at all for paths that don't exist in the given repo at the given oid. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Reported-by: Fydor Wire Snark <wsnark@tuta.io> Jason A. Donenfeld2019-05-201-1/+3
* ui-shared: fix broken sizeof in title setting and rewrite•••The old algorithm was totally incorrect. While we're at it, use « instead of \, since it makes more sense. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2019-01-021-26/+8
* auth-filter: pass url with query string attached•••Otherwise redirections come out wrong. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2018-11-251-2/+35
* ui-shared: ban strcat()•••Git upstream bans strcat() with commit: banned.h: mark strcat() as banned 1b11b64b815db62f93a04242e4aed5687a448748 To avoid compiler warnings from gcc 8.1.x we get the hard way. Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2018-09-111-4/+8
* Fix gcc 8.1.1 compiler warnings••• CC ../shared.o ../shared.c: In function ‘expand_macro’: ../shared.c:487:3: warning: ‘strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=] strncpy(name, value, len); ^~~~~~~~~~~~~~~~~~~~~~~~~ ../shared.c:484:9: note: length computed here len = strlen(value); ^~~~~~~~~~~~~ ../ui-shared.c: In function ‘cgit_repobasename’: ../ui-shared.c:136:2: warning: ‘strncpy’ specified bound 1024 equals destination size [-Wstringop-truncation] strncpy(rvbuf, reponame, sizeof(rvbuf)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CC ../ui-ssdiff.o ../ui-ssdiff.c: In function ‘replace_tabs’: ../ui-ssdiff.c:142:4: warning: ‘strncat’ output truncated copying between 1 and 8 bytes from a string of length 8 [-Wstringop-truncation] strncat(result, spaces, 8 - (strlen(result) % 8)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2018-07-041-7/+12
* snapshot: support tar signature for compressed tar•••This adds support for kernel.org style signatures where the uncompressed tar archive is signed and compressed later. The signature is valid for all tar* snapshots. We have a filter which snapshots may be generated and downloaded. This has to allow tar signatures now even if tar itself is not allowed. To simplify things we allow all signatures. Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2018-07-031-1/+8
* extra-head-content: introduce another option for meta tags•••This is to support things like go-import meta tags, which are on a per-repo basis. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2018-07-031-0/+2
* global: remove functionality we deprecated for cgit v1.0•••The man page states these were deprecated for v1.0. We are past v1.1, so remove the functionality. Signed-off-by: Christian Hesse <mail@eworm.de> Reviewed-by: John Keeping <john@keeping.me.uk> Christian Hesse2018-06-271-2/+0
* snapshot: strip bit from struct cgit_snapshot_format•••We had a static bit value in struct cgit_snapshot_format. We do not rely on it and things can be calculated on the fly. So strip it. Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2018-06-271-1/+1
* snapshot: support archive signatures•••Read signatures from the notes refs refs/notes/signatures/$FORMAT where FORMAT is one of our archive formats ("tar", "tar.gz", ...). The note is expected to simply contain the signature content to be returned when the snapshot "${filename}.asc" is requested, so the signature for cgit-1.1.tar.xz can be stored against the v1.1 tag with: git notes --ref=refs/notes/signatures/tar.xz add -C "$( gpg --output - --armor --detach-sign cgit-1.1.tar.xz | git hash-object -w --stdin )" v1.1 and then downloaded by simply appending ".asc" to the archive URL. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-0/+7
* ui-shared: pass separator in to cgit_print_snapshot_links()•••cgit_print_snapshot_links() is almost identical to print_tag_downloads(), so let's extract the difference to a parameter in preparation for removing print_tag_downloads() in the next commit. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-2/+3
* ui-shared: use the same snapshot logic as ui-refs•••Make snapshot links in the commit UI use the same prefix algorithm as those in the summary UI, so that refs starting with the snapshot prefix are used as-is rather than composed with the prefix repeated. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-1/+7
* ui-shared: rename parameter to cgit_print_snapshot_links()•••This is expected to be a ref not a hex object ID, so name it more appropriately. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-2/+2
* ui-shared: remove unused parameter•••The "head" parameter to cgit_print_snapshot_links() is never used, so remove it. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-2/+1
* Add "snapshot-prefix" repo configuration•••Allow using a user-specified value for the prefix in snapshot files instead of the repository basename. For example, files downloaded from the linux-stable.git repository should be named linux-$VERSION and not linux-stable-$VERSION, which can be achieved by setting: repo.snapshot-prefix=linux Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-1/+9
* ui-shared: pass repo object to print_snapshot_links()•••Both call sites of cgit_print_snapshot_links() use the same values for the snapshot mask and repository name, which are derived from the cgit_repo structure so let's pass in the structure and access the fields directly. Signed-off-by: John Keeping <john@keeping.me.uk> Reviewed-by: Christian Hesse <mail@eworm.de> John Keeping2018-06-271-4/+4
* print git version string in footer•••This helps tracking what git version cgit uses. The security implications are low as anybody can look up the version of our submodule anyway. The paranoid can use a custom footer. :-p On the other hand this brings potential security issues to the administrators eyes... Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2018-06-271-2/+3
* git: update to v2.17.1•••Update to git version v2.17.1. Required changes: * The function 'typename' has been renamed to 'type_name' (upstream commit debca9d2fe784193dc2d9f98b5edac605ddfefbb) Signed-off-by: Christian Hesse <mail@eworm.de> Christian Hesse2018-06-271-1/+1
* ui-shared: use type='search' for the search box•••Signed-off-by: Ville Skyttä <ville.skytta@iki.fi> Ville Skyttä2017-10-151-2/+2
* ui-tree: link to blame UI if enabled•••Create links to the blame page. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk> Jeff Smith2017-10-031-3/+17
* ui-shared: make a char* parameter const•••All cgit_xxx_link functions take const char* for the 'name' parameter, except for cgit_commit_link, which takes a char* and subsequently modifies the contents. Avoiding the content changes, and making it const char* will avoid the need to make copies of const char* strings being passed to cgit_commit_link. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk> Jeff Smith2017-10-031-11/+8
* ui-tree: move set_title_from_path to ui-shared•••The ui-blame code will also need to call set_title_from_path, so go ahead and move it to ui-shared. Signed-off-by: Jeff Smith <whydoubt@gmail.com> Reviewed-by: John Keeping <john@keeping.me.uk> Jeff Smith2017-10-031-0/+31
* ui-shared: don't print path crumbs without a repo•••cgit_print_path_crumbs() can call repolink() which assumes that ctx.repo is non-null. Currently we don't have any commands that set want_vpath without also setting want_repo so it shouldn't be possible to fail this test, but the check in cgit.c is in the wrong order so it is possible to specify a query string like "?p=log&path=foo/bar" to end up here without a valid repository. This was found by American fuzzy lop [0]. [0] http://lcamtuf.coredump.cx/afl/ Signed-off-by: John Keeping <john@keeping.me.uk> John Keeping2017-08-101-1/+1
* ui-shared: replace 'unsigned char sha1[20]' with 'struct object_id oid'•••Upstream git is replacing 'unsigned char sha1[20]' with 'struct object_id oid'. We have some code that can be changed independent from upstream. So here we go... Christian Hesse2016-10-041-5/+5
* ui-shared: fix decl-after-statement warnings•••git.git's coding style avoids decl-after-statement and we generally try to follow it but a few warnings have crept in recently. Fix the ones in ui-shared.c Signed-off-by: John Keeping <john@keeping.me.uk> John Keeping2016-10-011-5/+7
* ui-shared: fix segfault when defbranch is NULL•••Not sure if there's a better fix for this. defbranch is NULL here on my setup when a crawler hit an invalid URL, causing strcmp to segfault. Signed-off-by: Eric Wong <normalperson@yhbt.net> Eric Wong2016-07-061-1/+1
* Avoid ambiguities when prettifying snapshot names•••When composing snapshot file names for a tag with a prefix of the form v[0-9] (resp. V[0-9]), the leading "v" (resp. "V") is stripped. This leads to conflicts if a tag with the stripped name already exists or if there are tags only differing in the capitalization of the leading "v". Make sure we do not strip the "v" in these cases. Reported-by: Juuso Lapinlampi <wub@partyvan.eu> Signed-off-by: Lukas Fleischer <lfleischer@lfos.de> Lukas Fleischer2016-07-051-5/+21
* Hosted on HTTPS nowJason A. Donenfeld2016-06-071-1/+1
* forms: action should not be empty•••Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2016-05-121-1/+1
* ui-shared: Remove a name attribute with an empty value•••The name attribute is optional in an input element, but it must not be an empty value. See: https://html.spec.whatwg.org/#attr-fe-name See: https://html.spec.whatwg.org/#the-input-element Juuso Lapinlampi2016-05-121-1/+1
* ui-shared: HTML-ize DOCTYPE and <html>•••Get rid of the XHTML headers, bringing cgit slowly to the modern age of HTML. Juuso Lapinlampi2016-05-121-3/+2
* ui-shared: Simplify cgit_print_error_page() logicJuuso Lapinlampi2016-05-121-4/+2
* ui-shared: redirect should not exit early for cache•••Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2016-02-261-1/+0
* tabs: do not use target=_blankJason A. Donenfeld2016-02-231-1/+1
* ui-shared: add homepage to tabs•••Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Jason A. Donenfeld2016-02-221-0/+5
* Avoid DATE_STRFTIME for long/short dates•••Git's DATE_STRFTIME ignores the timezone argument and just uses the local timezone regardless of whether the "local" flag is set. Since our existing FMT_LONGDATE and FMT_SHORTDATE are pretty-much perfect matches to DATE_ISO8601 and DATE_SHORT, switch to taking a date_mode_type directly in cgit_date_mode(). Signed-off-by: John Keeping <john@keeping.me.uk> John Keeping2016-02-081-7/+6