mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 23:10:29 +03:00
Changed latest apps from being rendered by update.py to wp-fdroid.php.
This also adds icons to the latest app widget listing.
This commit is contained in:
parent
9e77ebd899
commit
2f4d198589
2 changed files with 22 additions and 8 deletions
14
update.py
14
update.py
|
|
@ -494,18 +494,18 @@ for apk in apks:
|
|||
knownapks.recordapk(apk['apkname'], apk['id'])
|
||||
knownapks.writeifchanged()
|
||||
|
||||
# Generate latest apps HTML for widget
|
||||
html = '<p>'
|
||||
# Generate latest apps data for widget
|
||||
data = ''
|
||||
for line in file(os.path.join('stats', 'latestapps.txt')):
|
||||
appid = line.rstrip()
|
||||
html += '<a href="/repository/browse/?fdid=' + appid + '">'
|
||||
data += appid + "\t"
|
||||
for app in apps:
|
||||
if app['id'] == appid:
|
||||
html += app['Name'] + '</a><br>'
|
||||
data += app['Name'] + "\t"
|
||||
data += app['icon'] + "\n"
|
||||
break
|
||||
html += '</p>'
|
||||
f = open('repo/latestapps.html', 'w')
|
||||
f.write(html)
|
||||
f = open('repo/latestapps.dat', 'w')
|
||||
f.write(data)
|
||||
f.close()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -722,7 +722,21 @@ function widget_fdroidlatest($args) {
|
|||
extract($args);
|
||||
echo $before_widget;
|
||||
echo $before_title . 'Latest Apps' . $after_title;
|
||||
readfile(getenv('DOCUMENT_ROOT').'/repo/latestapps.html');
|
||||
|
||||
$handle = fopen(getenv('DOCUMENT_ROOT').'/repo/latestapps.dat', 'r');
|
||||
if ($handle) {
|
||||
while (($buffer = fgets($handle, 4096)) !== false) {
|
||||
$app = explode("\t", $buffer);
|
||||
echo '<a href="/repository/browse/?fdid='.$app[0].'">';
|
||||
if(trim($app[2])) {
|
||||
echo '<img src="http://f-droid.org/repo/icons/'.$app[2].'" style="width:32px;border:none;float:right;" />';
|
||||
}
|
||||
echo $app[1].'<br />';
|
||||
echo '</a><br style="clear:both;" />';
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue