mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-26 16:03:02 +00:00
Merge branch 'master' of https://github.com/syuilo/misskey
This commit is contained in:
commit
eaeb27f3d1
3 changed files with 15 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,7 +2,6 @@
|
|||
/.vscode
|
||||
/node_modules
|
||||
/built
|
||||
/uploads
|
||||
/data
|
||||
npm-debug.log
|
||||
*.pem
|
||||
|
|
|
@ -40,7 +40,7 @@ const addFile = async (
|
|||
folderId: mongodb.ObjectID = null,
|
||||
force: boolean = false
|
||||
) => {
|
||||
log(`registering ${name} (user: ${user.username})`);
|
||||
log(`registering ${name} (user: ${user.username}, path: ${path})`);
|
||||
|
||||
// Calculate hash, get content type and get file size
|
||||
const [hash, [mime, ext], size] = await Promise.all([
|
||||
|
@ -210,7 +210,8 @@ export default (user: any, file: string | stream.Readable, ...args) => new Promi
|
|||
.catch(rej);
|
||||
}
|
||||
rej(new Error('un-compatible file.'));
|
||||
}).then(([path, remove]): Promise<any> => new Promise((res, rej) => {
|
||||
})
|
||||
.then(([path, remove]): Promise<any> => new Promise((res, rej) => {
|
||||
addFile(user, path, ...args)
|
||||
.then(file => {
|
||||
res(file);
|
||||
|
|
|
@ -40,7 +40,7 @@ app.get('/', (req, res) => {
|
|||
endpoints.forEach(endpoint =>
|
||||
endpoint.withFile ?
|
||||
app.post(`/${endpoint.name}`,
|
||||
endpoint.withFile ? multer({ dest: 'uploads/' }).single('file') : null,
|
||||
endpoint.withFile ? multer({ storage: multer.diskStorage({}) }).single('file') : null,
|
||||
require('./api-handler').default.bind(null, endpoint)) :
|
||||
app.post(`/${endpoint.name}`,
|
||||
require('./api-handler').default.bind(null, endpoint))
|
||||
|
|
Loading…
Reference in a new issue