|
diff --git a/cgit.h b/cgit.h index 5f7af51..6c6c460 100644 --- a/ cgit.h+++ b/ cgit.h |
|
@@ -10,16 +10,17 @@ |
10 | #include <commit.h> |
10 | #include <commit.h> |
11 | #include <tag.h> |
11 | #include <tag.h> |
12 | #include <diff.h> |
12 | #include <diff.h> |
13 | #include <diffcore.h> |
13 | #include <diffcore.h> |
14 | #include <refs.h> |
14 | #include <refs.h> |
15 | #include <revision.h> |
15 | #include <revision.h> |
16 | #include <log-tree.h> |
16 | #include <log-tree.h> |
17 | #include <archive.h> |
17 | #include <archive.h> |
| |
18 | #include <string-list.h> |
18 | #include <xdiff-interface.h> |
19 | #include <xdiff-interface.h> |
19 | #include <xdiff/xdiff.h> |
20 | #include <xdiff/xdiff.h> |
20 | #include <utf8.h> |
21 | #include <utf8.h> |
21 | |
22 | |
22 | |
23 | |
23 | /* |
24 | /* |
24 | * Dateformats used on misc. pages |
25 | * Dateformats used on misc. pages |
25 | */ |
26 | */ |
@@ -43,34 +44,49 @@ |
43 | * Default encoding |
44 | * Default encoding |
44 | */ |
45 | */ |
45 | #define PAGE_ENCODING "UTF-8" |
46 | #define PAGE_ENCODING "UTF-8" |
46 | |
47 | |
47 | typedef void (*configfn)(const char *name, const char *value); |
48 | typedef void (*configfn)(const char *name, const char *value); |
48 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
49 | typedef void (*filepair_fn)(struct diff_filepair *pair); |
49 | typedef void (*linediff_fn)(char *line, int len); |
50 | typedef void (*linediff_fn)(char *line, int len); |
50 | |
51 | |
| |
52 | struct cgit_filter { |
| |
53 | char *cmd; |
| |
54 | char **argv; |
| |
55 | int old_stdout; |
| |
56 | int pipe_fh[2]; |
| |
57 | int pid; |
| |
58 | int exitstatus; |
| |
59 | }; |
| |
60 | |
51 | struct cgit_repo { |
61 | struct cgit_repo { |
52 | char *url; |
62 | char *url; |
53 | char *name; |
63 | char *name; |
54 | char *path; |
64 | char *path; |
55 | char *desc; |
65 | char *desc; |
56 | char *owner; |
66 | char *owner; |
57 | char *defbranch; |
67 | char *defbranch; |
58 | char *group; |
| |
59 | char *module_link; |
68 | char *module_link; |
60 | char *readme; |
69 | char *readme; |
| |
70 | char *section; |
61 | char *clone_url; |
71 | char *clone_url; |
62 | int snapshots; |
72 | int snapshots; |
63 | int enable_log_filecount; |
73 | int enable_log_filecount; |
64 | int enable_log_linecount; |
74 | int enable_log_linecount; |
65 | int max_stats; |
75 | int max_stats; |
66 | time_t mtime; |
76 | time_t mtime; |
| |
77 | struct cgit_filter *about_filter; |
| |
78 | struct cgit_filter *commit_filter; |
| |
79 | struct cgit_filter *source_filter; |
67 | }; |
80 | }; |
68 | |
81 | |
| |
82 | typedef void (*repo_config_fn)(struct cgit_repo *repo, const char *name, |
| |
83 | const char *value); |
| |
84 | |
69 | struct cgit_repolist { |
85 | struct cgit_repolist { |
70 | int length; |
86 | int length; |
71 | int count; |
87 | int count; |
72 | struct cgit_repo *repos; |
88 | struct cgit_repo *repos; |
73 | }; |
89 | }; |
74 | |
90 | |
75 | struct commitinfo { |
91 | struct commitinfo { |
76 | struct commit *commit; |
92 | struct commit *commit; |
@@ -131,64 +147,92 @@ struct cgit_query { |
131 | |
147 | |
132 | struct cgit_config { |
148 | struct cgit_config { |
133 | char *agefile; |
149 | char *agefile; |
134 | char *cache_root; |
150 | char *cache_root; |
135 | char *clone_prefix; |
151 | char *clone_prefix; |
136 | char *css; |
152 | char *css; |
137 | char *favicon; |
153 | char *favicon; |
138 | char *footer; |
154 | char *footer; |
| |
155 | char *head_include; |
139 | char *header; |
156 | char *header; |
140 | char *index_header; |
157 | char *index_header; |
141 | char *index_info; |
158 | char *index_info; |
142 | char *logo; |
159 | char *logo; |
143 | char *logo_link; |
160 | char *logo_link; |
144 | char *module_link; |
161 | char *module_link; |
145 | char *repo_group; |
| |
146 | char *robots; |
162 | char *robots; |
147 | char *root_title; |
163 | char *root_title; |
148 | char *root_desc; |
164 | char *root_desc; |
149 | char *root_readme; |
165 | char *root_readme; |
150 | char *script_name; |
166 | char *script_name; |
| |
167 | char *section; |
151 | char *virtual_root; |
168 | char *virtual_root; |
152 | int cache_size; |
169 | int cache_size; |
153 | int cache_dynamic_ttl; |
170 | int cache_dynamic_ttl; |
154 | int cache_max_create_time; |
171 | int cache_max_create_time; |
155 | int cache_repo_ttl; |
172 | int cache_repo_ttl; |
156 | int cache_root_ttl; |
173 | int cache_root_ttl; |
| |
174 | int cache_scanrc_ttl; |
157 | int cache_static_ttl; |
175 | int cache_static_ttl; |
| |
176 | int embedded; |
| |
177 | int enable_filter_overrides; |
158 | int enable_index_links; |
178 | int enable_index_links; |
159 | int enable_log_filecount; |
179 | int enable_log_filecount; |
160 | int enable_log_linecount; |
180 | int enable_log_linecount; |
| |
181 | int enable_tree_linenumbers; |
161 | int local_time; |
182 | int local_time; |
162 | int max_repo_count; |
183 | int max_repo_count; |
163 | int max_commit_count; |
184 | int max_commit_count; |
164 | int max_lock_attempts; |
185 | int max_lock_attempts; |
165 | int max_msg_len; |
186 | int max_msg_len; |
166 | int max_repodesc_len; |
187 | int max_repodesc_len; |
167 | int max_stats; |
188 | int max_stats; |
168 | int nocache; |
189 | int nocache; |
| |
190 | int noplainemail; |
| |
191 | int noheader; |
169 | int renamelimit; |
192 | int renamelimit; |
170 | int snapshots; |
193 | int snapshots; |
171 | int summary_branches; |
194 | int summary_branches; |
172 | int summary_log; |
195 | int summary_log; |
173 | int summary_tags; |
196 | int summary_tags; |
| |
197 | struct string_list mimetypes; |
| |
198 | struct cgit_filter *about_filter; |
| |
199 | struct cgit_filter *commit_filter; |
| |
200 | struct cgit_filter *source_filter; |
174 | }; |
201 | }; |
175 | |
202 | |
176 | struct cgit_page { |
203 | struct cgit_page { |
177 | time_t modified; |
204 | time_t modified; |
178 | time_t expires; |
205 | time_t expires; |
179 | size_t size; |
206 | size_t size; |
180 | char *mimetype; |
207 | char *mimetype; |
181 | char *charset; |
208 | char *charset; |
182 | char *filename; |
209 | char *filename; |
| |
210 | char *etag; |
183 | char *title; |
211 | char *title; |
| |
212 | int status; |
| |
213 | char *statusmsg; |
| |
214 | }; |
| |
215 | |
| |
216 | struct cgit_environment { |
| |
217 | char *cgit_config; |
| |
218 | char *http_host; |
| |
219 | char *https; |
| |
220 | char *no_http; |
| |
221 | char *path_info; |
| |
222 | char *query_string; |
| |
223 | char *request_method; |
| |
224 | char *script_name; |
| |
225 | char *server_name; |
| |
226 | char *server_port; |
184 | }; |
227 | }; |
185 | |
228 | |
186 | struct cgit_context { |
229 | struct cgit_context { |
| |
230 | struct cgit_environment env; |
187 | struct cgit_query qry; |
231 | struct cgit_query qry; |
188 | struct cgit_config cfg; |
232 | struct cgit_config cfg; |
189 | struct cgit_repo *repo; |
233 | struct cgit_repo *repo; |
190 | struct cgit_page page; |
234 | struct cgit_page page; |
191 | }; |
235 | }; |
192 | |
236 | |
193 | struct cgit_snapshot_format { |
237 | struct cgit_snapshot_format { |
194 | const char *suffix; |
238 | const char *suffix; |
@@ -237,10 +281,14 @@ extern char *fmt(const char *format,...); |
237 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
281 | extern struct commitinfo *cgit_parse_commit(struct commit *commit); |
238 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
282 | extern struct taginfo *cgit_parse_tag(struct tag *tag); |
239 | extern void cgit_parse_url(const char *url); |
283 | extern void cgit_parse_url(const char *url); |
240 | |
284 | |
241 | extern const char *cgit_repobasename(const char *reponame); |
285 | extern const char *cgit_repobasename(const char *reponame); |
242 | |
286 | |
243 | extern int cgit_parse_snapshots_mask(const char *str); |
287 | extern int cgit_parse_snapshots_mask(const char *str); |
244 | |
288 | |
| |
289 | extern int cgit_open_filter(struct cgit_filter *filter); |
| |
290 | extern int cgit_close_filter(struct cgit_filter *filter); |
| |
291 | |
| |
292 | extern int readfile(const char *path, char **buf, size_t *size); |
245 | |
293 | |
246 | #endif /* CGIT_H */ |
294 | #endif /* CGIT_H */ |
|