[PATCH] gitweb: add readme to overview page

Subsystems: the rest

STALE3757d

3 messages, 1 author, 2016-06-15 · open the first message on its own page

[PATCH] gitweb: add readme to overview page

From: Heinrich Schuchardt <hidden>
Date: 2016-06-15 22:55:14

For repositories it is possible to maintain a README.html which will
be shown on the summary page. This is not possible for the server
root.

German law requires to provide contact data on the web server. This
data could easily be entered in the overview page using a README.html.

Furthermore it is possible to put the repositories not directly into
the root directory but into a subdirectory. Here also a README.html
would be helpful to indicate what the subdirectory is about.

The patch introduces README.html functionality for the root directory
and all subdirectories.

Signed-off-by: Heinrich Schuchardt <redacted>
---
 gitweb/gitweb.perl |   12 ++++++++++++
 1 file changed, 12 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 10ed9e5..30cd028 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6369,6 +6369,18 @@ sub git_project_list {
 	}
 
 	git_project_search_form($searchtext, $search_use_regexp);
+    # If XSS prevention is on, we don't include README.html.
+    # TODO: Allow a readme in some safe format.
+	my $path = "/";
+	if (defined $project_filter) {
+	    $path .= $project_filter;
+	}
+    if (!$prevent_xss && -s "$projectroot$path/README.html") {
+        print "<div class=\"title\">readme</div>\n" .
+              "<div class=\"readme\">\n";
+        insert_file("$projectroot$path/README.html");
+        print "\n</div>\n"; # class="readme"
+    }
 	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
-- 
1.7.10.4

Re: [PATCH] gitweb: add readme to overview page

From: Xypron <hidden>
Date: 2016-06-15 22:55:27

Hello Junio,

thank you for your comment in message
[off-list ref]
that message [off-list ref]
lost the thread context.

As already described I would be happy if a README.html could be added to
the overview page of gitweb.

Please, find below an updated patch. Compared to the first version of my
patch it avoids a warning concerning doubled slashes in filenames and adds
a subtitle "projects" between the README and the project list.

Best regards

Heinrich Schuchardt

Subject: [PATCH] gitweb: add readme to overview page

For repositories it is possible to maintain a README.html which will
be shown on the summary page. This is not possible for the server
root.

German law requires to provide contact data on the web server. This
data could easily be entered in the overview page using a README.html.

Furthermore it is possible to put the repositories not directly into
the root directory but into a subdirectory. Here also a README.html
would be helpful to indicate what the subdirectory is about.

The patch introduces README.html functionality for the root directory
and all subdirectories.

Signed-off-by: Heinrich Schuchardt <redacted>
---
 gitweb/gitweb.perl |   13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e8812fa..618b0d8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6368,6 +6368,19 @@ sub git_project_list {
 	}
 
 	git_project_search_form($searchtext, $search_use_regexp);
+	# If XSS prevention is on, we don't include README.html.
+	# TODO: Allow a readme in some safe format.
+	my $path = "";
+	if (defined $project_filter) {
+		$path = "/$project_filter";
+	}
+	if (!$prevent_xss && -s "$projectroot$path/README.html") {
+		print "<div class=\"title\">readme</div>\n" .
+		"<div class=\"readme\">\n";
+		insert_file("$projectroot$path/README.html");
+		print "\n</div>\n"; # class="readme"
+	}
+	print "<div class=\"title\">projects</div>\n";
 	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
-- 
1.7.10.4

Re: [PATCH] gitweb: add readme to overview page

From: Xypron <hidden>
Date: 2016-06-15 22:55:27

The following setting provides the same feature

# html text to include at home page
$home_text = "indextext.html";

Sorry for the noise.

Best regards

Heinrich Schuchardt

On 29.11.2012 23:30, Xypron wrote:
quoted hunk
Hello Junio,

thank you for your comment in message
[off-list ref]
that message [off-list ref]
lost the thread context.

As already described I would be happy if a README.html could be added to
the overview page of gitweb.

Please, find below an updated patch. Compared to the first version of my
patch it avoids a warning concerning doubled slashes in filenames and adds
a subtitle "projects" between the README and the project list.

Best regards

Heinrich Schuchardt

Subject: [PATCH] gitweb: add readme to overview page

For repositories it is possible to maintain a README.html which will
be shown on the summary page. This is not possible for the server
root.

German law requires to provide contact data on the web server. This
data could easily be entered in the overview page using a README.html.

Furthermore it is possible to put the repositories not directly into
the root directory but into a subdirectory. Here also a README.html
would be helpful to indicate what the subdirectory is about.

The patch introduces README.html functionality for the root directory
and all subdirectories.

Signed-off-by: Heinrich Schuchardt <redacted>
---
 gitweb/gitweb.perl |   13 +++++++++++++
 1 file changed, 13 insertions(+)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index e8812fa..618b0d8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -6368,6 +6368,19 @@ sub git_project_list {
 	}
 
 	git_project_search_form($searchtext, $search_use_regexp);
+	# If XSS prevention is on, we don't include README.html.
+	# TODO: Allow a readme in some safe format.
+	my $path = "";
+	if (defined $project_filter) {
+		$path = "/$project_filter";
+	}
+	if (!$prevent_xss && -s "$projectroot$path/README.html") {
+		print "<div class=\"title\">readme</div>\n" .
+		"<div class=\"readme\">\n";
+		insert_file("$projectroot$path/README.html");
+		print "\n</div>\n"; # class="readme"
+	}
+	print "<div class=\"title\">projects</div>\n";
 	git_project_list_body(\@list, $order);
 	git_footer_html();
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help