file browser
This commit is contained in:
parent
a508ef0e57
commit
99a074a974
6
app.js
6
app.js
@ -1,7 +1,7 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const app = express()
|
const app = express()
|
||||||
const port = 3003
|
const port = 3003
|
||||||
const serveIndex = require('serve-index')
|
const serveIndex = require('./src/utils/serve_index')
|
||||||
const {engine} = require('express-handlebars')
|
const {engine} = require('express-handlebars')
|
||||||
const indexRouter = require('./src/router/indexRouter')
|
const indexRouter = require('./src/router/indexRouter')
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ const publicPath = "/public"
|
|||||||
const inUrlPath = "public"
|
const inUrlPath = "public"
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const { template } = require('handlebars')
|
||||||
|
|
||||||
app.engine('.hbs', engine({extname: '.hbs', helpers: {
|
app.engine('.hbs', engine({extname: '.hbs', helpers: {
|
||||||
ifDivisibleBy: function (index, divisor, options) {
|
ifDivisibleBy: function (index, divisor, options) {
|
||||||
@ -21,9 +21,9 @@ app.engine('.hbs', engine({extname: '.hbs', helpers: {
|
|||||||
app.set('view engine', '.hbs');
|
app.set('view engine', '.hbs');
|
||||||
|
|
||||||
app.use(publicPath, express.static(inUrlPath), serveIndex(inUrlPath, {
|
app.use(publicPath, express.static(inUrlPath), serveIndex(inUrlPath, {
|
||||||
icons: true
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Listening on port ${port}`)
|
console.log(`Listening on port ${port}`)
|
||||||
})
|
})
|
||||||
|
17
package-lock.json
generated
17
package-lock.json
generated
@ -9,10 +9,12 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"byte-size": "^9.0.0",
|
||||||
"csv": "^6.3.10",
|
"csv": "^6.3.10",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
"express-handlebars": "^8.0.1",
|
"express-handlebars": "^8.0.1",
|
||||||
"hbs": "^4.2.0",
|
"hbs": "^4.2.0",
|
||||||
|
"japanese-date-converter": "^2.0.0",
|
||||||
"serve-index": "^1.9.1"
|
"serve-index": "^1.9.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -121,6 +123,15 @@
|
|||||||
"balanced-match": "^1.0.0"
|
"balanced-match": "^1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/byte-size": {
|
||||||
|
"version": "9.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/byte-size/-/byte-size-9.0.0.tgz",
|
||||||
|
"integrity": "sha512-xrJ8Hki7eQ6xew55mM6TG9zHI852OoAHcPfduWWtR6yxk2upTuIZy13VioRBDyHReHDdbeDPifUboeNkK/sXXA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/bytes": {
|
"node_modules/bytes": {
|
||||||
"version": "3.1.2",
|
"version": "3.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||||
@ -718,6 +729,12 @@
|
|||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/japanese-date-converter": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/japanese-date-converter/-/japanese-date-converter-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-O8wNRmrG05giGcAUUOuzplU24wp57kOxRMMOrwOCnFVQBoaOCxmnsVouVgjtcEuQzTj0/Y31Iuy5Hq2qzTWbCw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/lru-cache": {
|
"node_modules/lru-cache": {
|
||||||
"version": "11.0.1",
|
"version": "11.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz",
|
||||||
|
@ -10,10 +10,12 @@
|
|||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"description": "",
|
"description": "",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"byte-size": "^9.0.0",
|
||||||
"csv": "^6.3.10",
|
"csv": "^6.3.10",
|
||||||
"express": "^4.21.0",
|
"express": "^4.21.0",
|
||||||
"express-handlebars": "^8.0.1",
|
"express-handlebars": "^8.0.1",
|
||||||
"hbs": "^4.2.0",
|
"hbs": "^4.2.0",
|
||||||
|
"japanese-date-converter": "^2.0.0",
|
||||||
"serve-index": "^1.9.1"
|
"serve-index": "^1.9.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
4
public/styles/public_list/index.css
Normal file
4
public/styles/public_list/index.css
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
ul{
|
||||||
|
list-style-type: none;
|
||||||
|
}
|
||||||
|
|
526
src/utils/serve_index.js
Normal file
526
src/utils/serve_index.js
Normal file
@ -0,0 +1,526 @@
|
|||||||
|
/*!
|
||||||
|
* serve-index
|
||||||
|
* Copyright(c) 2011 Sencha Inc.
|
||||||
|
* Copyright(c) 2011 TJ Holowaychuk
|
||||||
|
* Copyright(c) 2014-2015 Douglas Christopher Wilson
|
||||||
|
* MIT Licensed
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module dependencies.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
var accepts = require('accepts');
|
||||||
|
var createError = require('http-errors');
|
||||||
|
var debug = require('debug')('serve-index');
|
||||||
|
var escapeHtml = require('escape-html');
|
||||||
|
var fs = require('fs')
|
||||||
|
, path = require('path')
|
||||||
|
, normalize = path.normalize
|
||||||
|
, sep = path.sep
|
||||||
|
, extname = path.extname
|
||||||
|
, join = path.join;
|
||||||
|
var Batch = require('batch');
|
||||||
|
var mime = require('mime-types');
|
||||||
|
var parseUrl = require('parseurl');
|
||||||
|
const { JapaneseDateConverter } = require('japanese-date-converter');
|
||||||
|
var resolve = require('path').resolve;
|
||||||
|
const byteSize = require('byte-size')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Module exports.
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
module.exports = serveIndex;
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Icon cache.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var cache = {};
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Default template.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var defaultTemplate = join(__dirname, 'public', 'directory.html');
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* .
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Media types and the map for content negotiation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var mediaTypes = [
|
||||||
|
'text/html',
|
||||||
|
'text/plain',
|
||||||
|
'application/json'
|
||||||
|
];
|
||||||
|
|
||||||
|
var mediaType = {
|
||||||
|
'text/html': 'html',
|
||||||
|
'text/plain': 'plain',
|
||||||
|
'application/json': 'json'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Serve directory listings with the given `root` path.
|
||||||
|
*
|
||||||
|
* See Readme.md for documentation of options.
|
||||||
|
*
|
||||||
|
* @param {String} root
|
||||||
|
* @param {Object} options
|
||||||
|
* @return {Function} middleware
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
|
||||||
|
function serveIndex(root, options) {
|
||||||
|
var opts = options || {};
|
||||||
|
|
||||||
|
// root required
|
||||||
|
if (!root) {
|
||||||
|
throw new TypeError('serveIndex() root path required');
|
||||||
|
}
|
||||||
|
|
||||||
|
// resolve root to absolute and normalize
|
||||||
|
var rootPath = normalize(resolve(root) + sep);
|
||||||
|
|
||||||
|
var filter = opts.filter;
|
||||||
|
var hidden = opts.hidden;
|
||||||
|
var icons = opts.icons;
|
||||||
|
var template = opts.template || defaultTemplate;
|
||||||
|
var view = opts.view || 'tiles';
|
||||||
|
|
||||||
|
return function (req, res, next) {
|
||||||
|
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
||||||
|
res.statusCode = 'OPTIONS' === req.method ? 200 : 405;
|
||||||
|
res.setHeader('Allow', 'GET, HEAD, OPTIONS');
|
||||||
|
res.setHeader('Content-Length', '0');
|
||||||
|
res.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse URLs
|
||||||
|
var url = parseUrl(req);
|
||||||
|
var originalUrl = parseUrl.original(req);
|
||||||
|
var dir = decodeURIComponent(url.pathname);
|
||||||
|
var originalDir = decodeURIComponent(originalUrl.pathname);
|
||||||
|
|
||||||
|
// join / normalize from root dir
|
||||||
|
var path = normalize(join(rootPath, dir));
|
||||||
|
|
||||||
|
// null byte(s), bad request
|
||||||
|
if (~path.indexOf('\0')) return next(createError(400));
|
||||||
|
|
||||||
|
// malicious path
|
||||||
|
if ((path + sep).substr(0, rootPath.length) !== rootPath) {
|
||||||
|
debug('malicious path "%s"', path);
|
||||||
|
return next(createError(403));
|
||||||
|
}
|
||||||
|
|
||||||
|
// determine ".." display
|
||||||
|
var showUp = normalize(resolve(path) + sep) !== rootPath;
|
||||||
|
|
||||||
|
// check if we have a directory
|
||||||
|
debug('stat "%s"', path);
|
||||||
|
fs.stat(path, function(err, stat){
|
||||||
|
if (err && err.code === 'ENOENT') {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
err.status = err.code === 'ENAMETOOLONG'
|
||||||
|
? 414
|
||||||
|
: 500;
|
||||||
|
return next(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stat.isDirectory()) return next();
|
||||||
|
|
||||||
|
// fetch files
|
||||||
|
debug('readdir "%s"', path);
|
||||||
|
fs.readdir(path, function(err, files){
|
||||||
|
if (err) return next(err);
|
||||||
|
if (!hidden) files = removeHidden(files);
|
||||||
|
if (filter) files = files.filter(function(filename, index, list) {
|
||||||
|
return filter(filename, index, list, path);
|
||||||
|
});
|
||||||
|
files.sort();
|
||||||
|
|
||||||
|
// content-negotiation
|
||||||
|
var accept = accepts(req);
|
||||||
|
var type = accept.type(mediaTypes);
|
||||||
|
|
||||||
|
// not acceptable
|
||||||
|
if (!type) return next(createError(406));
|
||||||
|
serveIndex[mediaType[type]](req, res, files, next, originalDir, showUp, icons, path, view, template, );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Respond with text/html.
|
||||||
|
*/
|
||||||
|
|
||||||
|
serveIndex.html = function _html(req, res, files, next, dir, showUp, _icons, path, view, template, ) {
|
||||||
|
|
||||||
|
if (showUp) {
|
||||||
|
files.unshift('..');
|
||||||
|
}
|
||||||
|
|
||||||
|
// stat all files
|
||||||
|
stat(path, files, function (err, stats) {
|
||||||
|
if (err) return next(err);
|
||||||
|
|
||||||
|
// combine the stats into the file list
|
||||||
|
var fileList = files.map(function (file, i) {
|
||||||
|
const stat = stats[i]
|
||||||
|
const date = new Date(stat.mtimeMs)
|
||||||
|
const japanese_date = new JapaneseDateConverter({
|
||||||
|
inputValue: date.toISOString().split('T')[0],
|
||||||
|
settings: {
|
||||||
|
format: date.toISOString().split('T')[0],
|
||||||
|
format: 'yyyy年M月dd日'
|
||||||
|
}
|
||||||
|
}).execute()
|
||||||
|
const time = date.getHours() + '時' + date.getMinutes() + '分'
|
||||||
|
const date_string = japanese_date + ' - ' + time
|
||||||
|
const size = stat.isDirectory() ? null : byteSize(stat.size).toString()
|
||||||
|
return { name: file,
|
||||||
|
stat,
|
||||||
|
size,
|
||||||
|
modificationDate: date_string,
|
||||||
|
icon: stat.isDirectory() ? { className: 'icon-directory', fileName: icons.folder } : iconLookup(path + file)}
|
||||||
|
});
|
||||||
|
|
||||||
|
// sort file list
|
||||||
|
fileList.sort(fileSort);
|
||||||
|
|
||||||
|
// read
|
||||||
|
if (err) return next(err);
|
||||||
|
|
||||||
|
// create locals for rendering
|
||||||
|
var locals = {
|
||||||
|
directory: dir,
|
||||||
|
fileList: fileList,
|
||||||
|
path: path,
|
||||||
|
};
|
||||||
|
|
||||||
|
send(res, locals)
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Respond with application/json.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// serveIndex.json = function _json(req, res, files) {
|
||||||
|
// send(res, 'application/json', JSON.stringify(files))
|
||||||
|
// };
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * Respond with text/plain.
|
||||||
|
// */
|
||||||
|
|
||||||
|
// serveIndex.plain = function _plain(req, res, files) {
|
||||||
|
// send(res, 'text/plain', (files.join('\n') + '\n'))
|
||||||
|
// };
|
||||||
|
|
||||||
|
function fileSort(a, b) {
|
||||||
|
// sort ".." to the top
|
||||||
|
if (a.name === '..' || b.name === '..') {
|
||||||
|
return a.name === b.name ? 0
|
||||||
|
: a.name === '..' ? -1 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Number(b.stat && b.stat.isDirectory()) - Number(a.stat && a.stat.isDirectory()) ||
|
||||||
|
String(a.name).toLocaleLowerCase().localeCompare(String(b.name).toLocaleLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map html `dir`, returning a linked path.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function htmlPath(dir) {
|
||||||
|
var parts = dir.split('/');
|
||||||
|
var crumb = new Array(parts.length);
|
||||||
|
|
||||||
|
for (var i = 0; i < parts.length; i++) {
|
||||||
|
var part = parts[i];
|
||||||
|
|
||||||
|
if (part) {
|
||||||
|
parts[i] = encodeURIComponent(part);
|
||||||
|
crumb[i] = '<a href="' + escapeHtml(parts.slice(0, i + 1).join('/')) + '">' + escapeHtml(part) + '</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return crumb.join(' / ');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the icon data for the file name.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function iconLookup(filename) {
|
||||||
|
var ext = extname(filename);
|
||||||
|
|
||||||
|
// try by extension
|
||||||
|
if (icons[ext]) {
|
||||||
|
return {
|
||||||
|
className: 'icon-' + ext.substring(1),
|
||||||
|
fileName: icons[ext]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var mimetype = mime.lookup(ext);
|
||||||
|
|
||||||
|
// default if no mime type
|
||||||
|
if (!mimetype) {
|
||||||
|
return {
|
||||||
|
className: 'icon-default',
|
||||||
|
fileName: icons.default
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// try by mime type
|
||||||
|
if (icons[mimetype]) {
|
||||||
|
return {
|
||||||
|
className: 'icon-' + mimetype.replace('/', '-'),
|
||||||
|
fileName: icons[mimetype]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var suffix = mimetype.split('+')[1];
|
||||||
|
|
||||||
|
if (suffix && icons['+' + suffix]) {
|
||||||
|
return {
|
||||||
|
className: 'icon-' + suffix,
|
||||||
|
fileName: icons['+' + suffix]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var type = mimetype.split('/')[0];
|
||||||
|
|
||||||
|
// try by type only
|
||||||
|
if (icons[type]) {
|
||||||
|
return {
|
||||||
|
className: 'icon-' + type,
|
||||||
|
fileName: icons[type]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
className: 'icon-default',
|
||||||
|
fileName: icons.default
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load icon images, return css string.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load and cache the given `icon`.
|
||||||
|
*
|
||||||
|
* @param {String} icon
|
||||||
|
* @return {String}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes the path separator from system separator
|
||||||
|
* to URL separator, aka `/`.
|
||||||
|
*
|
||||||
|
* @param {String} path
|
||||||
|
* @return {String}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function normalizeSlashes(path) {
|
||||||
|
return path.split(sep).join('/');
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter "hidden" `files`, aka files
|
||||||
|
* beginning with a `.`.
|
||||||
|
*
|
||||||
|
* @param {Array} files
|
||||||
|
* @return {Array}
|
||||||
|
* @api private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function removeHidden(files) {
|
||||||
|
return files.filter(function(file){
|
||||||
|
return '.' != file[0];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send a response.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
|
||||||
|
function send (res, locals) {
|
||||||
|
// security header for content sniffing
|
||||||
|
res.setHeader('X-Content-Type-Options', 'nosniff')
|
||||||
|
res.render("list", {
|
||||||
|
locals,
|
||||||
|
stylesheet: '/public/styles/public_list/index.css',
|
||||||
|
title: "Listing " + locals.directory
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Stat all files and return array of stat
|
||||||
|
* in same order.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function stat(dir, files, cb) {
|
||||||
|
var batch = new Batch();
|
||||||
|
|
||||||
|
batch.concurrency(10);
|
||||||
|
|
||||||
|
files.forEach(function(file){
|
||||||
|
batch.push(function(done){
|
||||||
|
fs.stat(join(dir, file), function(err, stat){
|
||||||
|
if (err && err.code !== 'ENOENT') return done(err);
|
||||||
|
|
||||||
|
// pass ENOENT as null stat, not error
|
||||||
|
done(null, stat || null);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
batch.end(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Icon map.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var icons = {
|
||||||
|
// base icons
|
||||||
|
'default': 'file.png',
|
||||||
|
'folder': 'folder.png',
|
||||||
|
|
||||||
|
// generic mime type icons
|
||||||
|
'image': 'image.png',
|
||||||
|
'text': 'text.png',
|
||||||
|
'video': 'image.png',
|
||||||
|
|
||||||
|
// generic mime suffix icons
|
||||||
|
'+json': 'text_program.png',
|
||||||
|
'+xml': 'text_program.png',
|
||||||
|
'+zip': 'file.png',
|
||||||
|
|
||||||
|
// specific mime type icons
|
||||||
|
'application/font-woff': 'file.png',
|
||||||
|
'application/javascript': 'text_program.png',
|
||||||
|
'application/json': 'file.png',
|
||||||
|
'application/msword': 'text.png',
|
||||||
|
'application/pdf': 'text.png',
|
||||||
|
'application/postscript': 'page_white_vector.png',
|
||||||
|
'application/rtf': 'text.png',
|
||||||
|
'application/vnd.ms-excel': 'page_white_excel.png',
|
||||||
|
'application/vnd.ms-powerpoint': 'page_white_powerpoint.png',
|
||||||
|
'application/vnd.oasis.opendocument.presentation': 'page_white_powerpoint.png',
|
||||||
|
'application/vnd.oasis.opendocument.spreadsheet': 'page_white_excel.png',
|
||||||
|
'application/vnd.oasis.opendocument.text': 'page_white_word.png',
|
||||||
|
'application/x-7z-compressed': 'file.png',
|
||||||
|
'application/x-sh': 'application_xp_terminal.png',
|
||||||
|
'application/x-font-ttf': 'file.png',
|
||||||
|
'application/x-msaccess': 'list.png',
|
||||||
|
'application/x-shockwave-flash': 'file.png',
|
||||||
|
'application/x-sql': 'file.png',
|
||||||
|
'application/x-tar': 'file.png',
|
||||||
|
'application/x-xz': 'file.png',
|
||||||
|
'application/xml': 'list.png',
|
||||||
|
'application/zip': 'file.png',
|
||||||
|
'image/svg+xml': 'page_white_vector.png',
|
||||||
|
'text/css': 'text_program.png',
|
||||||
|
'text/html': 'text_program.png',
|
||||||
|
'text/less': 'text_program.png',
|
||||||
|
|
||||||
|
// other, extension-specific icons
|
||||||
|
'.accdb': 'list.png',
|
||||||
|
'.apk': 'file.png',
|
||||||
|
'.app': 'application_xp.png',
|
||||||
|
'.as': 'page_white_actionscript.png',
|
||||||
|
'.asc': 'lock.png',
|
||||||
|
'.asp': 'page_white_code.png',
|
||||||
|
'.aspx': 'page_white_code.png',
|
||||||
|
'.avb': 'kiki.png',
|
||||||
|
'.AVB': 'kiki.png',
|
||||||
|
'.bat': 'application_xp_terminal.png',
|
||||||
|
'.bgb': 'bgb.png',
|
||||||
|
'.BGB': 'bgb.png',
|
||||||
|
'.bz2': 'box.png',
|
||||||
|
'.c': 'page_white_c.png',
|
||||||
|
'.cab': 'box.png',
|
||||||
|
'.cfm': 'page_white_coldfusion.png',
|
||||||
|
'.clj': 'page_white_code.png',
|
||||||
|
'.cc': 'page_white_cplusplus.png',
|
||||||
|
'.cgi': 'application_xp_terminal.png',
|
||||||
|
'.cpp': 'page_white_cplusplus.png',
|
||||||
|
'.cs': 'page_white_csharp.png',
|
||||||
|
'.csv': 'list.png',
|
||||||
|
'.db': 'page_white_database.png',
|
||||||
|
'.dbf': 'page_white_database.png',
|
||||||
|
'.deb': 'box.png',
|
||||||
|
'.dll': 'page_white_gear.png',
|
||||||
|
'.dmg': 'drive.png',
|
||||||
|
'.docx': 'page_white_word.png',
|
||||||
|
'.erb': 'page_white_ruby.png',
|
||||||
|
'.exe': 'application_xp.png',
|
||||||
|
'.fnt': 'font.png',
|
||||||
|
'.gam': 'controller.png',
|
||||||
|
'.gz': 'box.png',
|
||||||
|
'.h': 'page_white_h.png',
|
||||||
|
'.ini': 'page_white_gear.png',
|
||||||
|
'.iso': 'cd.png',
|
||||||
|
'.jar': 'box.png',
|
||||||
|
'.java': 'page_white_cup.png',
|
||||||
|
'.jsp': 'page_white_cup.png',
|
||||||
|
'.lua': 'page_white_code.png',
|
||||||
|
'.lz': 'box.png',
|
||||||
|
'.lzma': 'box.png',
|
||||||
|
'.m': 'page_white_code.png',
|
||||||
|
'.map': 'map.png',
|
||||||
|
'.msi': 'box.png',
|
||||||
|
'.mv4': 'film.png',
|
||||||
|
'.otf': 'font.png',
|
||||||
|
'.pdb': 'page_white_database.png',
|
||||||
|
'.php': 'page_white_php.png',
|
||||||
|
'.pl': 'page_white_code.png',
|
||||||
|
'.pkg': 'box.png',
|
||||||
|
'.pptx': 'page_white_powerpoint.png',
|
||||||
|
'.psd': 'page_white_picture.png',
|
||||||
|
'.py': 'page_white_code.png',
|
||||||
|
'.rar': 'box.png',
|
||||||
|
'.rb': 'page_white_ruby.png',
|
||||||
|
'.rm': 'film.png',
|
||||||
|
'.rom': 'controller.png',
|
||||||
|
'.rpm': 'box.png',
|
||||||
|
'.sass': 'page_white_code.png',
|
||||||
|
'.sav': 'controller.png',
|
||||||
|
'.scss': 'page_white_code.png',
|
||||||
|
'.srt': 'page_white_text.png',
|
||||||
|
'.tbz2': 'box.png',
|
||||||
|
'.tgz': 'box.png',
|
||||||
|
'.tlz': 'box.png',
|
||||||
|
'.vb': 'page_white_code.png',
|
||||||
|
'.vbs': 'page_white_code.png',
|
||||||
|
'.xcf': 'page_white_picture.png',
|
||||||
|
'.xlsx': 'page_white_excel.png',
|
||||||
|
'.yaws': 'page_white_code.png'
|
||||||
|
};
|
@ -1,41 +1,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
{{> head }}
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<meta property="og:title" content="Home">
|
|
||||||
<meta content="『 リリカル・トカレフ 』" property="og:site_name">
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta property="og:image" content="public/images/backgrounds/shinkiheader.png">
|
|
||||||
<meta property="og:description" content="キルゼムアール">
|
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<meta name="theme-color" content="#FFAE42">
|
|
||||||
|
|
||||||
{{#if header_style}}
|
|
||||||
<link rel="stylesheet" href="{{header_style}}">
|
|
||||||
{{else}}
|
|
||||||
<link rel="stylesheet" href="/public/styles/home/header.css">
|
|
||||||
{{/if}}
|
|
||||||
<link rel="stylesheet" href="/public/styles/main.css">
|
|
||||||
<link rel="stylesheet" href="/public/styles/headeranim.css">
|
|
||||||
|
|
||||||
{{#if stylesheet}}
|
|
||||||
<link rel="stylesheet" href={{stylesheet}}>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if favicon}}
|
|
||||||
<link rel="icon" type="image/x-icon" href="{{favicon}}">
|
|
||||||
{{else}}
|
|
||||||
<link rel="icon" type="image/x-icon" href="/public/images/favicons/gb.png">
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if title}}
|
|
||||||
<title>{{title}}</title>
|
|
||||||
{{else}}
|
|
||||||
<title>Lyrical Tokarev~ 世界最後の日</title>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
{{#if headerPartial}}
|
{{#if headerPartial}}
|
||||||
|
25
views/list.hbs
Normal file
25
views/list.hbs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<body>
|
||||||
|
<section>
|
||||||
|
<h1> <a href="/">~</a> {{locals.directory}}</h1>
|
||||||
|
<table cellpadding="1">
|
||||||
|
<tablebody>
|
||||||
|
<tr align="left">
|
||||||
|
<th>Filename</th>
|
||||||
|
<th>Size</th>
|
||||||
|
<th>Last Updated</th>
|
||||||
|
</tr>
|
||||||
|
{{#each locals.fileList}}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{{locals.directory}}{{name}}"><img src="/public/images/icons/small/{{icon.fileName}}"></a> <a href="{{locals.directory}}{{name}}">{{name}}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{size}}
|
||||||
|
</td>
|
||||||
|
<td align="start">{{modificationDate}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tablebody>
|
||||||
|
</table>
|
||||||
|
</section>
|
||||||
|
</body>
|
34
views/partials/head.hbs
Normal file
34
views/partials/head.hbs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta property="og:title" content="Home">
|
||||||
|
<meta content="『 リリカル・トカレフ 』" property="og:site_name">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:image" content="public/images/backgrounds/shinkiheader.png">
|
||||||
|
<meta property="og:description" content="キルゼムアール">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="theme-color" content="#FFAE42">
|
||||||
|
|
||||||
|
{{#if header_style}}
|
||||||
|
<link rel="stylesheet" href="{{header_style}}">
|
||||||
|
{{else}}
|
||||||
|
<link rel="stylesheet" href="/public/styles/home/header.css">
|
||||||
|
{{/if}}
|
||||||
|
<link rel="stylesheet" href="/public/styles/main.css">
|
||||||
|
<link rel="stylesheet" href="/public/styles/headeranim.css">
|
||||||
|
|
||||||
|
{{#if stylesheet}}
|
||||||
|
<link rel="stylesheet" href={{stylesheet}}>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if favicon}}
|
||||||
|
<link rel="icon" type="image/x-icon" href="{{favicon}}">
|
||||||
|
{{else}}
|
||||||
|
<link rel="icon" type="image/x-icon" href="/public/images/favicons/gb.png">
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if title}}
|
||||||
|
<title>{{title}}</title>
|
||||||
|
{{else}}
|
||||||
|
<title>Lyrical Tokarev~ 世界最後の日</title>
|
||||||
|
{{/if}}
|
@ -1 +0,0 @@
|
|||||||
<h1>Nigger</h1>
|
|
Loading…
Reference in New Issue
Block a user