Merge branch 'master' of http://op-co.de/cgit
This commit is contained in:
		
							
								
								
									
										3
									
								
								cgit.c
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								cgit.c
									
									
									
									
									
								
							| @@ -165,6 +165,8 @@ void config_cb(const char *name, const char *value) | ||||
| 		ctx.cfg.max_msg_len = atoi(value); | ||||
| 	else if (!strcmp(name, "max-repodesc-length")) | ||||
| 		ctx.cfg.max_repodesc_len = atoi(value); | ||||
| 	else if (!strcmp(name, "max-blob-size")) | ||||
| 		ctx.cfg.max_blob_size = atoi(value); | ||||
| 	else if (!strcmp(name, "max-repo-count")) | ||||
| 		ctx.cfg.max_repo_count = atoi(value); | ||||
| 	else if (!strcmp(name, "max-commit-count")) | ||||
| @@ -270,6 +272,7 @@ static void prepare_context(struct cgit_context *ctx) | ||||
| 	ctx->cfg.max_lock_attempts = 5; | ||||
| 	ctx->cfg.max_msg_len = 80; | ||||
| 	ctx->cfg.max_repodesc_len = 80; | ||||
| 	ctx->cfg.max_blob_size = 0; | ||||
| 	ctx->cfg.max_stats = 0; | ||||
| 	ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; | ||||
| 	ctx->cfg.renamelimit = -1; | ||||
|   | ||||
							
								
								
									
										5
									
								
								cgit.css
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								cgit.css
									
									
									
									
									
								
							| @@ -162,6 +162,11 @@ table.list td a { | ||||
| 	color: black; | ||||
| } | ||||
|  | ||||
| table.list td a.ls-dir { | ||||
| 	font-weight: bold; | ||||
| 	color: #00f; | ||||
| } | ||||
|  | ||||
| table.list td a:hover { | ||||
| 	color: #00f; | ||||
| } | ||||
|   | ||||
							
								
								
									
										1
									
								
								cgit.h
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								cgit.h
									
									
									
									
									
								
							| @@ -185,6 +185,7 @@ struct cgit_config { | ||||
| 	int max_lock_attempts; | ||||
| 	int max_msg_len; | ||||
| 	int max_repodesc_len; | ||||
| 	int max_blob_size; | ||||
| 	int max_stats; | ||||
| 	int nocache; | ||||
| 	int noplainemail; | ||||
|   | ||||
| @@ -177,6 +177,10 @@ max-repodesc-length:: | ||||
| 	Specifies the maximum number of repo description characters to display | ||||
| 	on the repository index page. Default value: "80". | ||||
|  | ||||
| max-blob-size:: | ||||
| 	Specifies the maximum size of a blob to display HTML for in KBytes. | ||||
| 	Default value: "0" (limit disabled). | ||||
|  | ||||
| max-stats:: | ||||
| 	Set the default maximum statistics period. Valid values are "week", | ||||
| 	"month", "quarter" and "year". If unspecified, statistics are | ||||
|   | ||||
| @@ -3,6 +3,10 @@ | ||||
| # tree-view by refering to this file with the source-filter or repo.source- | ||||
| # filter options in cgitrc. | ||||
| # | ||||
| # This script requires a shell supporting the ${var##pattern} syntax. | ||||
| # It is supported by at least dash and bash, however busybox environments | ||||
| # might have to use an external call to sed instead. | ||||
| # | ||||
| # Note: the highlight command (http://www.andre-simon.de/) uses css for syntax | ||||
| # highlighting, so you'll probably want something like the following included | ||||
| # in your css file (generated by highlight 2.4.8 and adapted for cgit): | ||||
| @@ -20,20 +24,11 @@ | ||||
| # table.blob .kwc  { color:#000000; font-weight:bold; } | ||||
| # table.blob .kwd  { color:#010181; } | ||||
|  | ||||
| case "$1" in | ||||
| 	*.c) | ||||
| 		highlight -f -I -X -S c | ||||
| 		;; | ||||
| 	*.h) | ||||
| 		highlight -f -I -X -S c | ||||
| 		;; | ||||
| 	*.sh) | ||||
| 		highlight -f -I -X -S sh | ||||
| 		;; | ||||
| 	*.css) | ||||
| 		highlight -f -I -X -S css | ||||
| 		;; | ||||
| 	*) | ||||
| 		highlight -f -I -X -S txt | ||||
| 		;; | ||||
| esac | ||||
| # store filename and extension in local vars | ||||
| BASENAME="$1" | ||||
| EXTENSION="${BASENAME##*.}" | ||||
|  | ||||
| # map Makefile and Makefile.* to .mk | ||||
| [ "${BASENAME%%.*}" == "Makefile" ] && EXTENSION=mk | ||||
|  | ||||
| exec highlight --force -f -I -X -S $EXTENSION 2>/dev/null | ||||
|   | ||||
| @@ -107,6 +107,12 @@ static void print_object(const unsigned char *sha1, char *path, const char *base | ||||
| 		        curr_rev, path); | ||||
| 	htmlf(")<br/>blob: %s\n", sha1_to_hex(sha1)); | ||||
|  | ||||
| 	if (ctx.cfg.max_blob_size && size / 1024 > ctx.cfg.max_blob_size) { | ||||
| 		htmlf("<div class='error'>blob size (%dKB) exceeds display size limit (%dKB).</div>", | ||||
| 				size / 1024, ctx.cfg.max_blob_size); | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	if (buffer_is_binary(buf, size)) | ||||
| 		print_binary_buffer(buf, size); | ||||
| 	else | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Lars Hjemli
					Lars Hjemli