update historyDownload script and api/history for yyyy subfolder

This commit is contained in:
HF 2021-05-31 14:03:24 +02:00
parent 47bd8b85fc
commit a60c40c51f
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,9 @@ async function history(req: Request, res: Response) {
if (!BACKUP_DIR || !day || !id || day.includes('/') || day.includes('\\')) {
res.status(404).end();
}
const path = `${BACKUP_DIR}/${day}/${id}`;
const yyyy = day.slice(0, 4);
const mmdd = day.slice(4);
const path = `${BACKUP_DIR}/${yyyy}/${mmdd}/${id}`;
try {
if (!fs.existsSync(path)) {

View File

@ -120,7 +120,7 @@ async def get_area(canvas, x, y, w, h, start_date, end_date):
image = PIL.Image.new('RGBA', (w, h))
for iy in range(yc, hc + 1):
for ix in range(xc, wc + 1):
url = 'https://storage.pixelplanet.fun/%s/%s/tiles/%s/%s.png' % (iter_date, canvas_id, ix, iy)
url = 'https://storage.pixelplanet.fun/%s/%s/%s/tiles/%s/%s.png' % (iter_date[0:4], iter_date[4:], canvas_id, ix, iy)
offx = ix * 256 + offset - x
offy = iy * 256 + offset - y
tasks.append(fetch(session, url, offx, offy, image, bkg, True))
@ -153,7 +153,7 @@ async def get_area(canvas, x, y, w, h, start_date, end_date):
image_rel = image.copy()
for iy in range(yc, hc + 1):
for ix in range(xc, wc + 1):
url = 'https://storage.pixelplanet.fun/%s/%s/%s/%s/%s.png' % (iter_date, canvas_id, time, ix, iy)
url = 'https://storage.pixelplanet.fun/%s/%s/%s/%s/%s/%s.png' % (iter_date[0:4], iter_date[4:], canvas_id, time, ix, iy)
offx = ix * 256 + offset - x
offy = iy * 256 + offset - y
tasks.append(fetch(session, url, offx, offy, image_rel, bkg))