distroquery: make prefix to search page configurable (URL_SEARCH_PREFIX)

This commit is contained in:
Silvan Calarco 2015-03-29 23:45:03 +02:00
parent 53ac68d8d0
commit c7f47f3adf
3 changed files with 12 additions and 4 deletions

View File

@ -585,9 +585,10 @@ void printQueryResponse() {
sqlite3_finalize(stmt1); sqlite3_finalize(stmt1);
} }
if (query_compact) { if (query_compact) {
printf("<b><a href='/distribution/search.html?" printf("<b><a href='%s?"
"repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>" "repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
"%s</a></b> %s-%s - %s<br>", "%s</a></b> %s-%s - %s<br>",
query_repositories[i]->configdefaults->url_search_prefix,
query_repositories[i]->tag, query_repositories[i]->tag,
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
query_repositories[i]->arch[a], query_repositories[i]->arch[a],
@ -660,9 +661,10 @@ void printQueryResponse() {
if (query_compact) { if (query_compact) {
printf("<a href='/distribution/search.html?" printf("<a href='%s?"
"repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>" "repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
"%s</a> (%s-%s) %s %s<br>", "%s</a> (%s-%s) %s %s<br>",
query_repositories[i]->configdefaults->url_search_prefix,
query_repositories[i]->tag, query_repositories[i]->tag,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")),
query_repositories[i]->arch[a], query_repositories[i]->arch[a],
@ -775,9 +777,10 @@ void printQueryResponse() {
printf("<br><img class=\"distroqueryimg16\" src=\"%s\" width=\"16\" height=\"16\">&nbsp;", buffer); printf("<br><img class=\"distroqueryimg16\" src=\"%s\" width=\"16\" height=\"16\">&nbsp;", buffer);
if (query_compact) { if (query_compact) {
printf("<b><a href='/distribution/search.html?" printf("<b><a href='%s?"
"repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery'>" "repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
"%s</a></b> %s-%s - %s<br>", "%s</a></b> %s-%s - %s<br>",
query_repositories[i]->configdefaults->url_search_prefix,
query_repositories[i]->tag, query_repositories[i]->tag,
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
@ -1015,9 +1018,10 @@ void printSpecialQueryResponse() {
} }
printf("%s <img class=\"distroqueryimg12\" src=\"%s\" width=\"12\" height=\"12\">&nbsp;", strdate, buffer); printf("%s <img class=\"distroqueryimg12\" src=\"%s\" width=\"12\" height=\"12\">&nbsp;", strdate, buffer);
printf("<b><a href='/distribution/search.html?" printf("<b><a href='%s?"
"repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery' title=\"%s\">" "repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery' title=\"%s\">"
"%s</a></b> %s-%s", "%s</a></b> %s-%s",
query_repositories[i]->configdefaults->url_search_prefix,
ct->tag, ct->tag,
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX), htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX),

View File

@ -249,6 +249,9 @@ struct configTag* read_configuration(const char *confFile)
} else if (!strcmp(vartok, "URL_PREFIX")) { } else if (!strcmp(vartok, "URL_PREFIX")) {
configdefaults.url_prefix = configdefaults.url_prefix =
(char *) strdup(valuetok); (char *) strdup(valuetok);
} else if (!strcmp(vartok, "URL_SEARCH_PREFIX")) {
configdefaults.url_search_prefix =
(char *) strdup(valuetok);
} else if (!strcmp(vartok, "URL_DIR")) { } else if (!strcmp(vartok, "URL_DIR")) {
configdefaults.url_dir = configdefaults.url_dir =
(char *) strdup(valuetok); (char *) strdup(valuetok);

View File

@ -16,6 +16,7 @@ struct configDefaults {
char *distribution_name; char *distribution_name;
char *url_address; char *url_address;
char *url_prefix; char *url_prefix;
char *url_search_prefix;
char *url_dir; char *url_dir;
char *arch[ARCHS_MAX]; char *arch[ARCHS_MAX];
}; };