"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: gotwebd: remove PAGE handling
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Fri, 29 Dec 2023 19:52:59 +1100

Download raw body.

Thread
Omar Polo <op@omarpolo.com> wrote:
> the page querystring parameter long gone and currently unused.  ok to
> kill it?  we replaced it with the "more" buttons in all the views except
> for INDEX.

my favourite kind of diffs :)

ok

> diff /home/op/w/got
> commit - 452d8310907a64cc34ef0d0f1258a3ddc8bb5aea
> path + /home/op/w/got
> blob - be9adb8b334860eb82e321e678c1778977d97754
> file + gotwebd/gotweb.c
> --- gotwebd/gotweb.c
> +++ gotwebd/gotweb.c
> @@ -60,7 +60,6 @@ static const struct querystring_keys querystring_keys[
>  	{ "headref",		HEADREF },
>  	{ "index_page",		INDEX_PAGE },
>  	{ "path",		PATH },
> -	{ "page",		PAGE },
>  };
>  
>  static const struct action_keys action_keys[] = {
> @@ -232,7 +231,6 @@ gotweb_process_request(struct request *c)
>  		if (binary) {
>  			struct gotweb_url url = {
>  				.index_page = -1,
> -				.page = -1,
>  				.action = BLOBRAW,
>  				.path = qs->path,
>  				.commit = qs->commit,
> @@ -643,19 +641,6 @@ qa_found:
>  				goto done;
>  			}
>  			break;
> -		case PAGE:
> -			if (*value == '\0')
> -				break;
> -			(*qs)->page = strtonum(value, INT64_MIN,
> -			    INT64_MAX, &errstr);
> -			if (errstr) {
> -				error = got_error_from_errno3(__func__,
> -				    "strtonum", errstr);
> -				goto done;
> -			}
> -			if ((*qs)->page < 0)
> -				(*qs)->page = 0;
> -			break;
>  		}
>  
>  		/* entry found */
> @@ -776,7 +761,6 @@ gotweb_index_navs(struct request *c, struct gotweb_url
>  		*prev = (struct gotweb_url){
>  			.action = -1,
>  			.index_page = qs->index_page - 1,
> -			.page = -1,
>  		};
>  	}
>  	if (t->next_disp == srv->max_repos_display &&
> @@ -786,7 +770,6 @@ gotweb_index_navs(struct request *c, struct gotweb_url
>  		*next = (struct gotweb_url){
>  			.action = -1,
>  			.index_page = qs->index_page + 1,
> -			.page = -1,
>  		};
>  	}
>  }
> @@ -1069,12 +1052,6 @@ gotweb_render_url(struct request *c, struct gotweb_url
>  		sep = "&";
>  	}
>  
> -	if (url->page != -1) {
> -		if (tp_writef(c->tp, "%spage=%d", sep, url->page) == -1)
> -			return -1;
> -		sep = "&";
> -	}
> -
>  	return 0;
>  }
>  
> blob - e3fd4407e26812d1c9cfc32955e1a5d603f4a1a9
> file + gotwebd/gotwebd.h
> --- gotwebd/gotwebd.h
> +++ gotwebd/gotwebd.h
> @@ -383,7 +383,6 @@ struct gotwebd {
>  struct gotweb_url {
>  	int		 action;
>  	int		 index_page;
> -	int		 page;
>  	const char	*commit;
>  	const char	*previd;
>  	const char	*prevset;
> @@ -403,7 +402,6 @@ struct querystring {
>  	char		*headref;
>  	int		 index_page;
>  	char		*path;
> -	int		 page;
>  };
>  
>  struct querystring_keys {
> @@ -424,7 +422,6 @@ enum querystring_elements {
>  	HEADREF,
>  	INDEX_PAGE,
>  	PATH,
> -	PAGE,
>  };
>  
>  enum query_actions {
> blob - ae9add1ced0efa1b69df5c648929ad89710387a4
> file + gotwebd/pages.tmpl
> --- gotwebd/pages.tmpl
> +++ gotwebd/pages.tmpl
> @@ -113,7 +113,6 @@ nextsep(char *s, char **t)
>  
>  	memset(&url, 0, sizeof(url));
>  	url.index_page = -1;
> -	url.page = -1;
>  	url.action = TREE;
>  	url.path = qs->path;
>  	url.commit = qs->commit;
> @@ -172,7 +171,6 @@ nextsep(char *s, char **t)
>  
>  	memset(&u_path, 0, sizeof(u_path));
>  	u_path.index_page = -1;
> -	u_path.page = -1;
>  	u_path.action = SUMMARY;
>  !}
>  <!doctype html>
> @@ -280,32 +278,26 @@ nextsep(char *s, char **t)
>  	struct gotweb_url summary = {
>  		.action = SUMMARY,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	}, briefs = {
>  		.action = BRIEFS,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	}, commits = {
>  		.action = COMMITS,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	}, tags = {
>  		.action = TAGS,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	}, tree = {
>  		.action = TREE,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	}, rss = {
>  		.action = RSS,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	};
>  !}
> @@ -360,21 +352,18 @@ nextsep(char *s, char **t)
>  	diff_url = (struct gotweb_url){
>  		.action = DIFF,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  		.headref = qs->headref,
>  	};
>  	patch_url = (struct gotweb_url){
>  		.action = PATCH,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  		.headref = qs->headref,
>  	};
>  	tree_url = (struct gotweb_url){
>  		.action = TREE,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  		.headref = qs->headref,
>  	};
> @@ -518,19 +507,16 @@ nextsep(char *s, char **t)
>  	diff = (struct gotweb_url){
>  		.action = DIFF,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	};
>  	patch = (struct gotweb_url){
>  		.action = PATCH,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	};
>  	tree = (struct gotweb_url){
>  		.action = TREE,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	};
>  !}
> @@ -591,7 +577,6 @@ nextsep(char *s, char **t)
>  
>  	memset(&briefs_url, 0, sizeof(briefs_url));
>  	briefs_url.index_page = -1,
> -	briefs_url.page = -1,
>  	briefs_url.action = BRIEFS,
>  	briefs_url.path = qs->path,
>  	briefs_url.commit = qs->commit,
> @@ -684,7 +669,6 @@ nextsep(char *s, char **t)
>  
>  	memset(&url, 0, sizeof(url));
>  	url.index_page = -1;
> -	url.page = -1;
>  	url.action = BLOB;
>  	url.path = t->qs->path;
>  	url.file = readme;
> @@ -762,7 +746,6 @@ nextsep(char *s, char **t)
>  	mode_t			 mode;
>  	struct gotweb_url	 url = {
>  	       .index_page = -1,
> -	       .page = -1,
>  	       .commit = rc->commit_id,
>  	       .path = qs->path,
>  	};
> @@ -865,7 +848,6 @@ nextsep(char *s, char **t)
>  	struct gotweb_url	 url = {
>  		.action = TAG,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  		.commit = rt->commit_id,
>  	};
> @@ -957,7 +939,6 @@ nextsep(char *s, char **t)
>  	struct gotweb_url	 patch_url, tree_url = {
>  		.action = TREE,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = qs->path,
>  		.commit = rc->commit_id,
>  	};
> @@ -1065,7 +1046,6 @@ nextsep(char *s, char **t)
>  	struct gotweb_url	 url = {
>  		.action = SUMMARY,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = qs->path,
>  	};
>  
> @@ -1153,7 +1133,6 @@ nextsep(char *s, char **t)
>  
>  	memset(&briefs_url, 0, sizeof(briefs_url));
>  	briefs_url.index_page = -1,
> -	briefs_url.page = -1,
>  	briefs_url.action = BRIEFS,
>  	briefs_url.path = qs->path,
>  	briefs_url.commit = qs->commit,
> @@ -1218,7 +1197,6 @@ nextsep(char *s, char **t)
>  	struct gotweb_url	 url = {
>  		.action = DIFF,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  		.commit = bline->id_str,
>  	};
> @@ -1289,7 +1267,6 @@ date: {{ datebuf }} {{ "\n" }}
>  	struct gotweb_url	 summary = {
>  		.action = SUMMARY,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  	};
>  !}
> @@ -1324,7 +1301,6 @@ date: {{ datebuf }} {{ "\n" }}
>  	struct gotweb_url	 tag = {
>  		.action = TAG,
>  		.index_page = -1,
> -		.page = -1,
>  		.path = repo_dir->name,
>  		.commit = rt->commit_id,
>  	};


-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68