Warning: session_start(): open(/var/lib/php/sessions/sess_4hvc59l0h7rb7qtdhi3dc7qr4k, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!752
static S dir = "/storage/sdcard0";
p {
serveHttp(7777);
run("#1000842"); // upload server on 8888
}
static NanoHTTPD.Response serve(S uri, NanoHTTPD.Method method,
Map header, Map params, Map files) {
print("Serving HTML.");
File d = new File(dir);
File sub = new File(dir, dropPrefix("/", uri));
print("File: " + sub.getAbsolutePath() + ", exists: " + sub.exists());
S html;
if (!sub.exists())
html = "Not found: " + quote(f2s(sub)) + " (uri: " + quote(uri) + ")";
else if (sub.isFile())
ret serveFile(sub);
else
html = fileLinks(findAllFiles(sub), d);
ret serveHTML(htitle("Phone Server.")
+ p(href("http://" + getMyIP() + ":8888", "Upload stuff"))
+ h3(sub.getAbsolutePath()) + html);
}
static S fileLinks(L files, File rootDir) {
new L l;
for (File f : files) {
S path = getRelPath(f, rootDir);
l.add(href(urlencode(dropPrefix("/", path)), path));
}
ret ul(l);
}
static S getRelPath(File f, File root) ctex {
ret dropPrefix(root.getCanonicalPath(), f.getCanonicalPath());
}