|
diff --git a/cgit.h b/cgit.h index 5f7af51..6c6c460 100644 --- a/ cgit.h+++ b/ cgit.h |
|
@@ -2,32 +2,33 @@ |
2 | #define CGIT_H |
2 | #define CGIT_H |
3 | |
3 | |
4 | |
4 | |
5 | #include <git-compat-util.h> |
5 | #include <git-compat-util.h> |
6 | #include <cache.h> |
6 | #include <cache.h> |
7 | #include <grep.h> |
7 | #include <grep.h> |
8 | #include <object.h> |
8 | #include <object.h> |
9 | #include <tree.h> |
9 | #include <tree.h> |
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 | */ |
26 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" |
27 | #define FMT_LONGDATE "%Y-%m-%d %H:%M:%S (%Z)" |
27 | #define FMT_SHORTDATE "%Y-%m-%d" |
28 | #define FMT_SHORTDATE "%Y-%m-%d" |
28 | #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" |
29 | #define FMT_ATOMDATE "%Y-%m-%dT%H:%M:%SZ" |
29 | |
30 | |
30 | |
31 | |
31 | /* |
32 | /* |
32 | * Limits used for relative dates |
33 | * Limits used for relative dates |
33 | */ |
34 | */ |
@@ -35,50 +36,65 @@ |
35 | #define TM_HOUR (TM_MIN * 60) |
36 | #define TM_HOUR (TM_MIN * 60) |
36 | #define TM_DAY (TM_HOUR * 24) |
37 | #define TM_DAY (TM_HOUR * 24) |
37 | #define TM_WEEK (TM_DAY * 7) |
38 | #define TM_WEEK (TM_DAY * 7) |
38 | #define TM_YEAR (TM_DAY * 365) |
39 | #define TM_YEAR (TM_DAY * 365) |
39 | #define TM_MONTH (TM_YEAR / 12.0) |
40 | #define TM_MONTH (TM_YEAR / 12.0) |
40 | |
41 | |
41 | |
42 | |
42 | /* |
43 | /* |
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; |
77 | char *author; |
93 | char *author; |
78 | char *author_email; |
94 | char *author_email; |
79 | unsigned long author_date; |
95 | unsigned long author_date; |
80 | char *committer; |
96 | char *committer; |
81 | char *committer_email; |
97 | char *committer_email; |
82 | unsigned long committer_date; |
98 | unsigned long committer_date; |
83 | char *subject; |
99 | char *subject; |
84 | char *msg; |
100 | char *msg; |
@@ -123,80 +139,108 @@ struct cgit_query { |
123 | char *mimetype; |
139 | char *mimetype; |
124 | char *url; |
140 | char *url; |
125 | char *period; |
141 | char *period; |
126 | int ofs; |
142 | int ofs; |
127 | int nohead; |
143 | int nohead; |
128 | char *sort; |
144 | char *sort; |
129 | int showmsg; |
145 | int showmsg; |
130 | }; |
146 | }; |
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; |
195 | const char *mimetype; |
239 | const char *mimetype; |
196 | write_archive_fn_t write_func; |
240 | write_archive_fn_t write_func; |
197 | int bit; |
241 | int bit; |
198 | }; |
242 | }; |
199 | |
243 | |
200 | extern const char *cgit_version; |
244 | extern const char *cgit_version; |
201 | |
245 | |
202 | extern struct cgit_repolist cgit_repolist; |
246 | extern struct cgit_repolist cgit_repolist; |
@@ -229,18 +273,22 @@ extern int cgit_diff_files(const unsigned char *old_sha1, |
229 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
273 | extern void cgit_diff_tree(const unsigned char *old_sha1, |
230 | const unsigned char *new_sha1, |
274 | const unsigned char *new_sha1, |
231 | filepair_fn fn, const char *prefix); |
275 | filepair_fn fn, const char *prefix); |
232 | |
276 | |
233 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
277 | extern void cgit_diff_commit(struct commit *commit, filepair_fn fn); |
234 | |
278 | |
235 | extern char *fmt(const char *format,...); |
279 | extern char *fmt(const char *format,...); |
236 | |
280 | |
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 */ |
|