From bb17425856ff42a8f53d5344c87383161d20194f Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 22 Mar 2017 16:19:32 +0900 Subject: [PATCH] #309 and some cleanups --- README.md | 2 +- {resources => assets}/apple-touch-icon.png | 0 {resources => assets}/logo.svg | 0 {resources => assets}/ss.jpg | 0 docs/BASE.pug | 2 +- gulpfile.ts | 20 +++++++++---------- resources/favicon/128.png | 3 --- resources/favicon/16.png | 3 --- resources/favicon/256.png | 3 --- resources/favicon/32.png | 3 --- resources/favicon/64.png | 3 --- resources/icon.ai | 3 --- resources/icon.png | 3 --- resources/icon.svg | 3 --- src/file/{resources => assets}/avatar.jpg | 0 src/file/{resources => assets}/bad-egg.png | 0 src/file/{resources => assets}/dummy.png | 0 src/file/server.ts | 12 +++++------ .../{resources => assets}/himasaku.png | 0 src/himasaku/{resources => assets}/index.html | 0 src/himasaku/server.ts | 4 ++-- src/web/about/{resources => assets}/style.css | 0 src/web/about/index.ts | 2 +- .../app/auth/{resources => assets}/logo.svg | 0 src/web/app/auth/tags/index.tag | 2 +- src/web/app/auth/view.pug | 2 +- src/web/app/base.pug | 4 ++-- src/web/app/client/script.js | 4 ++-- src/web/app/client/view.pug | 2 +- src/web/app/common/tags/core-error.tag | 2 +- src/web/app/common/tags/messaging/index.tag | 2 +- src/web/app/common/tags/messaging/message.tag | 2 +- .../header-logo-white.svg | 0 .../{resources => assets}/header-logo.svg | 0 .../desktop/{resources => assets}/remove.png | 0 src/web/app/desktop/tags/drive/file.tag | 6 +++--- src/web/app/desktop/tags/pages/entrance.tag | 2 +- src/web/app/desktop/tags/post-form.tag | 2 +- src/web/app/desktop/tags/ui-header.tag | 2 +- src/web/app/dev/view.pug | 2 +- src/web/app/mobile/tags/page/entrance.tag | 2 +- src/web/{resources => assets}/error.jpg | 0 {resources => src/web/assets}/favicon.ico | 0 src/web/{resources => assets}/label.svg | 0 src/web/{resources => assets}/manifest.json | 0 src/web/{resources => assets}/title.svg | 0 src/web/{resources => assets}/unread.svg | 0 src/web/resources/favicon.ico | 3 --- src/web/server.ts | 10 +++++----- 49 files changed, 44 insertions(+), 71 deletions(-) rename {resources => assets}/apple-touch-icon.png (100%) rename {resources => assets}/logo.svg (100%) rename {resources => assets}/ss.jpg (100%) delete mode 100644 resources/favicon/128.png delete mode 100644 resources/favicon/16.png delete mode 100644 resources/favicon/256.png delete mode 100644 resources/favicon/32.png delete mode 100644 resources/favicon/64.png delete mode 100644 resources/icon.ai delete mode 100644 resources/icon.png delete mode 100644 resources/icon.svg rename src/file/{resources => assets}/avatar.jpg (100%) rename src/file/{resources => assets}/bad-egg.png (100%) rename src/file/{resources => assets}/dummy.png (100%) rename src/himasaku/{resources => assets}/himasaku.png (100%) rename src/himasaku/{resources => assets}/index.html (100%) rename src/web/about/{resources => assets}/style.css (100%) rename src/web/app/auth/{resources => assets}/logo.svg (100%) rename src/web/app/desktop/{resources => assets}/header-logo-white.svg (100%) rename src/web/app/desktop/{resources => assets}/header-logo.svg (100%) rename src/web/app/desktop/{resources => assets}/remove.png (100%) rename src/web/{resources => assets}/error.jpg (100%) rename {resources => src/web/assets}/favicon.ico (100%) rename src/web/{resources => assets}/label.svg (100%) rename src/web/{resources => assets}/manifest.json (100%) rename src/web/{resources => assets}/title.svg (100%) rename src/web/{resources => assets}/unread.svg (100%) delete mode 100644 src/web/resources/favicon.ico diff --git a/README.md b/README.md index 09e1775b3..ccf8a3592 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Welcome! [Misskey](https://misskey.xyz) is a completely open source, ultimately sophisticated new type of mini-blog based SNS. -![ss](./resources/ss.jpg) +![ss](./assets/ss.jpg) Key features -------------------------------- diff --git a/resources/apple-touch-icon.png b/assets/apple-touch-icon.png similarity index 100% rename from resources/apple-touch-icon.png rename to assets/apple-touch-icon.png diff --git a/resources/logo.svg b/assets/logo.svg similarity index 100% rename from resources/logo.svg rename to assets/logo.svg diff --git a/resources/ss.jpg b/assets/ss.jpg similarity index 100% rename from resources/ss.jpg rename to assets/ss.jpg diff --git a/docs/BASE.pug b/docs/BASE.pug index 77eac6de9..633488202 100644 --- a/docs/BASE.pug +++ b/docs/BASE.pug @@ -8,7 +8,7 @@ html(lang='ja', dir='ltr') meta(name='theme-color', content=themeColor) meta(name='referrer', content='origin') meta(name='viewport', content='width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no') - link(rel='stylesheet', href='/resources/style.css') + link(rel='stylesheet', href='/assets/style.css') title block title | | About Misskey diff --git a/gulpfile.ts b/gulpfile.ts index 9ba88125f..6376e0f89 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -85,8 +85,8 @@ gulp.task('build:about:docs', () => { gulp.task('build:copy', () => es.merge( gulp.src([ - './src/**/resources/**/*', - '!./src/web/app/**/resources/**/*' + './src/**/assets/**/*', + '!./src/web/app/**/assets/**/*' ]).pipe(gulp.dest('./built/')) as any, gulp.src([ './src/web/about/**/*', @@ -134,11 +134,11 @@ gulp.task('build:client:scripts', done => { require('./webpack.config').then(webpackOptions => { es.merge( webpack(webpackOptions, require('webpack')) - .pipe(gulp.dest('./built/web/resources/')) as any, + .pipe(gulp.dest('./built/web/assets/')) as any, gulp.src('./src/web/app/client/script.js') .pipe(replace('VERSION', JSON.stringify(version))) //.pipe(isProduction ? uglify() : gutil.noop()) - .pipe(gulp.dest('./built/web/resources/client/')) as any + .pipe(gulp.dest('./built/web/assets/client/')) as any ); done(); }); @@ -150,22 +150,22 @@ gulp.task('build:client:styles', () => .pipe(isProduction ? (cssnano as any)() : gutil.noop()) - .pipe(gulp.dest('./built/web/resources/')) + .pipe(gulp.dest('./built/web/assets/')) ); gulp.task('copy:client', [ 'build:client:scripts' ], () => gulp.src([ - './resources/**/*', - './src/web/resources/**/*', - './src/web/app/*/resources/**/*' + './assets/**/*', + './src/web/assets/**/*', + './src/web/app/*/assets/**/*' ]) .pipe(isProduction ? (imagemin as any)() : gutil.noop()) .pipe(rename(path => { - path.dirname = path.dirname.replace('resources', '.'); + path.dirname = path.dirname.replace('assets', '.'); })) - .pipe(gulp.dest('./built/web/resources/')) + .pipe(gulp.dest('./built/web/assets/')) ); gulp.task('build:client:pug', [ diff --git a/resources/favicon/128.png b/resources/favicon/128.png deleted file mode 100644 index 4a88902ff..000000000 --- a/resources/favicon/128.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:00d723137953f380ac33c728072907e58e3021e104006f47916cfdf3978dfc9b -size 1423 diff --git a/resources/favicon/16.png b/resources/favicon/16.png deleted file mode 100644 index 27e4bf0c1..000000000 --- a/resources/favicon/16.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5559e14ff2e61645b4e54527c5d5d3b4c145c994ef0c4f9388dafc046494d7bc -size 323 diff --git a/resources/favicon/256.png b/resources/favicon/256.png deleted file mode 100644 index 386de3575..000000000 --- a/resources/favicon/256.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:653cf3f50c37f4c07b187a436108878c78e8cacfe7b585f13cf1b14104d39185 -size 2753 diff --git a/resources/favicon/32.png b/resources/favicon/32.png deleted file mode 100644 index d69d9fdcd..000000000 --- a/resources/favicon/32.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2d6f02ab2b97e88679faf914976c64b1b547d989c22a2c15848bc5c3b1bab0ee -size 532 diff --git a/resources/favicon/64.png b/resources/favicon/64.png deleted file mode 100644 index 8b45bdba3..000000000 --- a/resources/favicon/64.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7dbb90a74a361c7e08245596c73b03158e00e5b7a0cfa28f62735b05031f678a -size 930 diff --git a/resources/icon.ai b/resources/icon.ai deleted file mode 100644 index db0c70d8a..000000000 --- a/resources/icon.ai +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:440c08dea18da75849c117f4f063a47cdf559182888532ad01d7eeba461ceb28 -size 262881 diff --git a/resources/icon.png b/resources/icon.png deleted file mode 100644 index 386de3575..000000000 --- a/resources/icon.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:653cf3f50c37f4c07b187a436108878c78e8cacfe7b585f13cf1b14104d39185 -size 2753 diff --git a/resources/icon.svg b/resources/icon.svg deleted file mode 100644 index a8406fb48..000000000 --- a/resources/icon.svg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ca1d38e5b74ba63c58c6cfdef846527e47e16d730e7bc0822a8f45c89eced0e5 -size 843 diff --git a/src/file/resources/avatar.jpg b/src/file/assets/avatar.jpg similarity index 100% rename from src/file/resources/avatar.jpg rename to src/file/assets/avatar.jpg diff --git a/src/file/resources/bad-egg.png b/src/file/assets/bad-egg.png similarity index 100% rename from src/file/resources/bad-egg.png rename to src/file/assets/bad-egg.png diff --git a/src/file/resources/dummy.png b/src/file/assets/dummy.png similarity index 100% rename from src/file/resources/dummy.png rename to src/file/assets/dummy.png diff --git a/src/file/server.ts b/src/file/server.ts index 21447b596..8ab638aa6 100644 --- a/src/file/server.ts +++ b/src/file/server.ts @@ -24,7 +24,7 @@ app.use(cors()); /** * Statics */ -app.use('/resources', express.static(__dirname + '/resources', { +app.use('/assets', express.static(__dirname + '/assets', { maxAge: 1000 * 60 * 60 * 24 * 365 // 一年 })); @@ -33,12 +33,12 @@ app.get('/', (req, res) => { }); app.get('/default-avatar.jpg', (req, res) => { - const file = fs.readFileSync(__dirname + '/resources/avatar.jpg'); + const file = fs.readFileSync(__dirname + '/assets/avatar.jpg'); send(file, 'image/jpeg', req, res); }); app.get('/app-default.jpg', (req, res) => { - const file = fs.readFileSync(__dirname + '/resources/dummy.png'); + const file = fs.readFileSync(__dirname + '/assets/dummy.png'); send(file, 'image/png', req, res); }); @@ -54,7 +54,7 @@ async function raw(data: Buffer, type: string, download: boolean, res: express.R async function thumbnail(data: Buffer, type: string, resize: number, res: express.Response): Promise { if (!/^image\/.*$/.test(type)) { - data = fs.readFileSync(__dirname + '/resources/dummy.png'); + data = fs.readFileSync(__dirname + '/assets/dummy.png'); } let g = gm(data); @@ -100,7 +100,7 @@ app.get('/:id', async (req, res) => { const file = await File.findOne({_id: new mongodb.ObjectID(req.params.id)}); if (file == null) { - res.status(404).sendFile(__dirname + '/resources/dummy.png'); + res.status(404).sendFile(__dirname + '/assets/dummy.png'); return; } else if (file.data == null) { res.sendStatus(400); @@ -120,7 +120,7 @@ app.get('/:id/:name', async (req, res) => { const file = await File.findOne({_id: new mongodb.ObjectID(req.params.id)}); if (file == null) { - res.status(404).sendFile(__dirname + '/resources/dummy.png'); + res.status(404).sendFile(__dirname + '/assets/dummy.png'); return; } else if (file.data == null) { res.sendStatus(400); diff --git a/src/himasaku/resources/himasaku.png b/src/himasaku/assets/himasaku.png similarity index 100% rename from src/himasaku/resources/himasaku.png rename to src/himasaku/assets/himasaku.png diff --git a/src/himasaku/resources/index.html b/src/himasaku/assets/index.html similarity index 100% rename from src/himasaku/resources/index.html rename to src/himasaku/assets/index.html diff --git a/src/himasaku/server.ts b/src/himasaku/server.ts index e4fb0ef17..17edc6648 100644 --- a/src/himasaku/server.ts +++ b/src/himasaku/server.ts @@ -13,11 +13,11 @@ app.disable('x-powered-by'); app.locals.cache = true; app.get('/himasaku.png', (req, res) => { - res.sendFile(__dirname + '/resources/himasaku.png'); + res.sendFile(__dirname + '/assets/himasaku.png'); }); app.get('*', (req, res) => { - res.sendFile(__dirname + '/resources/index.html'); + res.sendFile(__dirname + '/assets/index.html'); }); module.exports = app; diff --git a/src/web/about/resources/style.css b/src/web/about/assets/style.css similarity index 100% rename from src/web/about/resources/style.css rename to src/web/about/assets/style.css diff --git a/src/web/about/index.ts b/src/web/about/index.ts index 18d259bcc..9fedeb627 100644 --- a/src/web/about/index.ts +++ b/src/web/about/index.ts @@ -3,7 +3,7 @@ import ms = require('ms'); const router = express.Router(); -router.use('/@/about/resources', express.static(`${__dirname}/resources`, { +router.use('/@/about/assets', express.static(`${__dirname}/assets`, { maxAge: ms('7 days') })); diff --git a/src/web/app/auth/resources/logo.svg b/src/web/app/auth/assets/logo.svg similarity index 100% rename from src/web/app/auth/resources/logo.svg rename to src/web/app/auth/assets/logo.svg diff --git a/src/web/app/auth/tags/index.tag b/src/web/app/auth/tags/index.tag index 218101f3d..6bc545df3 100644 --- a/src/web/app/auth/tags/index.tag +++ b/src/web/app/auth/tags/index.tag @@ -23,7 +23,7 @@

サインインしてください

-
Misskey
+
Misskey