distroquery: add changelog and date in lastest packages
This commit is contained in:
parent
2707361aaa
commit
5deae1025b
@ -817,7 +817,21 @@ void printSpecialQueryResponse() {
|
|||||||
sqlite3_stmt *statement, *stmt1;
|
sqlite3_stmt *statement, *stmt1;
|
||||||
struct configTag* ct;
|
struct configTag* ct;
|
||||||
int i;
|
int i;
|
||||||
|
long buildtime;
|
||||||
char updates[PATH_MAX];
|
char updates[PATH_MAX];
|
||||||
|
humanDate strdate;
|
||||||
|
|
||||||
|
struct tm *ytm;
|
||||||
|
time_t timesec;
|
||||||
|
|
||||||
|
timesec = time(×ec);
|
||||||
|
ytm = localtime((time_t *) ×ec);
|
||||||
|
ytm->tm_sec = 0;
|
||||||
|
ytm->tm_min = 0;
|
||||||
|
ytm->tm_hour = 0;
|
||||||
|
ytm->tm_mday = 1;
|
||||||
|
ytm->tm_mon = 0;
|
||||||
|
timesec = mktime(ytm);
|
||||||
|
|
||||||
if (strstr(query, "$latest$") == query) {
|
if (strstr(query, "$latest$") == query) {
|
||||||
repository = query + 8;
|
repository = query + 8;
|
||||||
@ -854,13 +868,38 @@ void printSpecialQueryResponse() {
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
snprintf(sql, PATH_MAX, "SELECT * FROM changelog,packagers "
|
||||||
|
"WHERE id_source=%d AND changelog.id_packager=packagers.id "
|
||||||
|
"ORDER BY changelog.time DESC LIMIT 2",
|
||||||
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
||||||
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
|
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n\n%s", _("Latest changes:"));
|
||||||
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
|
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s - %s (%s)\n%s",
|
||||||
|
(char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate),
|
||||||
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packagers", "name")),
|
||||||
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")),
|
||||||
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
|
||||||
|
}
|
||||||
|
// strncat(updates + strlen(updates) - 1, buffer, PATH_MAX - strlen(updates));
|
||||||
|
}
|
||||||
|
|
||||||
get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
|
get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
|
||||||
if (updates[0] != 0) {
|
if (updates[0] != 0) {
|
||||||
printf("<img src=\"/pub/openmamba/distromatic/pkgup.png\" title=\"%s\" width\"14\" height=\"14\"> ", updates);
|
printf("<img src=\"/pub/openmamba/distromatic/pkgup.png\" title=\"%s\" width\"14\" height=\"14\"> ", updates);
|
||||||
} else {
|
} else {
|
||||||
printf("<img src=\"/pub/openmamba/distromatic/pkg.png\" width\"14\" height=\"14\"> ");
|
printf("<img src=\"/pub/openmamba/distromatic/pkg.png\" width\"14\" height=\"14\"> ");
|
||||||
}
|
}
|
||||||
printf("<img src=\"%s\" width\"12\" height=\"12\"> ", buffer);
|
|
||||||
|
buildtime = sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime"));
|
||||||
|
if (buildtime < timesec) {
|
||||||
|
simpleTimeToTemplate(buildtime,"%Y/%m/%d",&strdate);
|
||||||
|
} else {
|
||||||
|
simpleTimeToTemplate(buildtime,"%m/%d",&strdate);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s <img src=\"%s\" width\"12\" height=\"12\"> ", strdate, buffer);
|
||||||
printf("<b><a href='/distribution/search.html?"
|
printf("<b><a href='/distribution/search.html?"
|
||||||
"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<br>",
|
"%s</a></b> %s-%s<br>",
|
||||||
|
Loading…
Reference in New Issue
Block a user