AVIF
This commit is contained in:
7
pub.py
7
pub.py
@@ -21,6 +21,7 @@ bench_view_ftm = """<a href="/img/bench/{0:03d}.1560.jpg"><picture><source type=
|
||||
|
||||
TYPE_MAP = {
|
||||
'asc': 'text/plain',
|
||||
'avif': 'image/avif',
|
||||
'css': 'text/css',
|
||||
'gif': 'image/gif',
|
||||
'html': 'text/html; charset=utf8',
|
||||
@@ -52,7 +53,7 @@ def upload_file(filename, overwrite=True):
|
||||
s3.upload_file(filename, BUCKET, filename, ExtraArgs={
|
||||
'ACL': 'public-read',
|
||||
'ContentType': TYPE_MAP[ext],
|
||||
'CacheControl': 'public, max-age={}'.format(31536000 if ext in ['gif', 'jpg', 'png', 'webp'] else 86400)
|
||||
'CacheControl': 'public, max-age={}'.format(31536000 if ext in ['avif', 'gif', 'jpg', 'png', 'webp'] else 86400)
|
||||
})
|
||||
|
||||
if (ext == 'html'):
|
||||
@@ -60,7 +61,7 @@ def upload_file(filename, overwrite=True):
|
||||
s3.upload_file(filename, BUCKET, filename[:-5], ExtraArgs={
|
||||
'ACL': 'public-read',
|
||||
'ContentType': TYPE_MAP[ext],
|
||||
'CacheControl': 'public, max-age={}'.format(31536000 if ext in ['gif', 'jpg', 'png', 'webp'] else 86400)
|
||||
'CacheControl': 'public, max-age={}'.format(31536000 if ext in ['avif', 'gif', 'jpg', 'png', 'webp'] else 86400)
|
||||
})
|
||||
|
||||
print('\tDone.')
|
||||
@@ -162,7 +163,7 @@ def upload_bench():
|
||||
upload_file(key, overwrite=False)
|
||||
|
||||
def upload_img():
|
||||
files = filter_filenames(os.listdir('img'), ['jpg', 'webp'])
|
||||
files = filter_filenames(os.listdir('img'), ['avif', 'jpg', 'webp'])
|
||||
for f in files:
|
||||
upload_file('img/{}'.format(f))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user