Initial import

This commit is contained in:
2026-06-04 11:13:34 +01:00
commit 563d9cc96d
143 changed files with 10572 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
class DownloadController {
public static function get_download($id) {
return new DownloadJob($id);
}
public static function start_download() {
}
public static function api_downloads() {
$s = DownloadJob::find([["processed", "=", 0], ["owner", "=", get_user()->id]])->orderBy("queued")->limit(20);
return $s->all();
}
public static function api_add_download($_request) {
$url = $_request->put("url");
$d = new DownloadJob;
$d->url = $url;
$d->queued = time();
$d->started = 0;
$d->finished = 0;
$d->processed = 0;
$d->owner = get_user()->id;
$d->file = sprintf("download/file-%08X-%08X", rand(), time());
$d->save();
return DownloadController::api_downloads();
}
}