|
diff --git a/cgit.c b/cgit.c index c82587b..e09c86e 100644 --- a/ cgit.c+++ b/ cgit.c |
|
@@ -133,48 +133,50 @@ static void querystring_cb(const char *name, const char *value) |
133 | } else if (!strcmp(name, "url")) { |
133 | } else if (!strcmp(name, "url")) { |
134 | ctx.qry.url = xstrdup(value); |
134 | ctx.qry.url = xstrdup(value); |
135 | cgit_parse_url(value); |
135 | cgit_parse_url(value); |
136 | } else if (!strcmp(name, "qt")) { |
136 | } else if (!strcmp(name, "qt")) { |
137 | ctx.qry.grep = xstrdup(value); |
137 | ctx.qry.grep = xstrdup(value); |
138 | } else if (!strcmp(name, "q")) { |
138 | } else if (!strcmp(name, "q")) { |
139 | ctx.qry.search = xstrdup(value); |
139 | ctx.qry.search = xstrdup(value); |
140 | } else if (!strcmp(name, "h")) { |
140 | } else if (!strcmp(name, "h")) { |
141 | ctx.qry.head = xstrdup(value); |
141 | ctx.qry.head = xstrdup(value); |
142 | ctx.qry.has_symref = 1; |
142 | ctx.qry.has_symref = 1; |
143 | } else if (!strcmp(name, "id")) { |
143 | } else if (!strcmp(name, "id")) { |
144 | ctx.qry.sha1 = xstrdup(value); |
144 | ctx.qry.sha1 = xstrdup(value); |
145 | ctx.qry.has_sha1 = 1; |
145 | ctx.qry.has_sha1 = 1; |
146 | } else if (!strcmp(name, "id2")) { |
146 | } else if (!strcmp(name, "id2")) { |
147 | ctx.qry.sha2 = xstrdup(value); |
147 | ctx.qry.sha2 = xstrdup(value); |
148 | ctx.qry.has_sha1 = 1; |
148 | ctx.qry.has_sha1 = 1; |
149 | } else if (!strcmp(name, "ofs")) { |
149 | } else if (!strcmp(name, "ofs")) { |
150 | ctx.qry.ofs = atoi(value); |
150 | ctx.qry.ofs = atoi(value); |
151 | } else if (!strcmp(name, "path")) { |
151 | } else if (!strcmp(name, "path")) { |
152 | ctx.qry.path = trim_end(value, '/'); |
152 | ctx.qry.path = trim_end(value, '/'); |
153 | } else if (!strcmp(name, "name")) { |
153 | } else if (!strcmp(name, "name")) { |
154 | ctx.qry.name = xstrdup(value); |
154 | ctx.qry.name = xstrdup(value); |
155 | } else if (!strcmp(name, "mimetype")) { |
155 | } else if (!strcmp(name, "mimetype")) { |
156 | ctx.qry.mimetype = xstrdup(value); |
156 | ctx.qry.mimetype = xstrdup(value); |
| |
157 | } else if (!strcmp(name, "s")){ |
| |
158 | ctx.qry.sort = xstrdup(value); |
157 | } |
159 | } |
158 | } |
160 | } |
159 | |
161 | |
160 | static void prepare_context(struct cgit_context *ctx) |
162 | static void prepare_context(struct cgit_context *ctx) |
161 | { |
163 | { |
162 | memset(ctx, 0, sizeof(ctx)); |
164 | memset(ctx, 0, sizeof(ctx)); |
163 | ctx->cfg.agefile = "info/web/last-modified"; |
165 | ctx->cfg.agefile = "info/web/last-modified"; |
164 | ctx->cfg.nocache = 0; |
166 | ctx->cfg.nocache = 0; |
165 | ctx->cfg.cache_size = 0; |
167 | ctx->cfg.cache_size = 0; |
166 | ctx->cfg.cache_dynamic_ttl = 5; |
168 | ctx->cfg.cache_dynamic_ttl = 5; |
167 | ctx->cfg.cache_max_create_time = 5; |
169 | ctx->cfg.cache_max_create_time = 5; |
168 | ctx->cfg.cache_repo_ttl = 5; |
170 | ctx->cfg.cache_repo_ttl = 5; |
169 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
171 | ctx->cfg.cache_root = CGIT_CACHE_ROOT; |
170 | ctx->cfg.cache_root_ttl = 5; |
172 | ctx->cfg.cache_root_ttl = 5; |
171 | ctx->cfg.cache_static_ttl = -1; |
173 | ctx->cfg.cache_static_ttl = -1; |
172 | ctx->cfg.css = "/cgit.css"; |
174 | ctx->cfg.css = "/cgit.css"; |
173 | ctx->cfg.logo = "/git-logo.png"; |
175 | ctx->cfg.logo = "/git-logo.png"; |
174 | ctx->cfg.local_time = 0; |
176 | ctx->cfg.local_time = 0; |
175 | ctx->cfg.max_repo_count = 50; |
177 | ctx->cfg.max_repo_count = 50; |
176 | ctx->cfg.max_commit_count = 50; |
178 | ctx->cfg.max_commit_count = 50; |
177 | ctx->cfg.max_lock_attempts = 5; |
179 | ctx->cfg.max_lock_attempts = 5; |
178 | ctx->cfg.max_msg_len = 80; |
180 | ctx->cfg.max_msg_len = 80; |
179 | ctx->cfg.max_repodesc_len = 80; |
181 | ctx->cfg.max_repodesc_len = 80; |
180 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
182 | ctx->cfg.module_link = "./?repo=%s&page=commit&id=%s"; |
|