mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-08 22:23:08 +02:00
✌️
This commit is contained in:
parent
c4e517ab15
commit
19e12bf5cf
19 changed files with 28 additions and 29 deletions
|
@ -47,6 +47,7 @@
|
|||
"@types/js-yaml": "3.5.29",
|
||||
"@types/mocha": "2.2.37",
|
||||
"@types/mongodb": "2.1.36",
|
||||
"@types/monk": "1.0.5",
|
||||
"@types/ms": "0.7.29",
|
||||
"@types/multer": "0.0.32",
|
||||
"@types/ratelimiter": "2.1.28",
|
||||
|
@ -108,7 +109,7 @@
|
|||
"mime-types": "2.1.14",
|
||||
"mocha": "3.2.0",
|
||||
"mongodb": "2.2.21",
|
||||
"mongoskin": "^2.1.0",
|
||||
"monk": "3.1.3",
|
||||
"ms": "0.7.2",
|
||||
"multer": "1.2.1",
|
||||
"nprogress": "0.2.0",
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
const collection = db.collection('access_tokens');
|
||||
const collection = db.get('access_tokens');
|
||||
|
||||
collection.createIndex('token');
|
||||
collection.createIndex('hash');
|
||||
(collection as any).index('token'); // fuck type definition
|
||||
(collection as any).index('hash'); // fuck type definition
|
||||
|
||||
export default collection;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
const collection = db.collection('apps');
|
||||
const collection = db.get('apps');
|
||||
|
||||
collection.createIndex('name_id');
|
||||
collection.createIndex('name_id_lower');
|
||||
collection.createIndex('secret');
|
||||
(collection as any).index('name_id'); // fuck type definition
|
||||
(collection as any).index('name_id_lower'); // fuck type definition
|
||||
(collection as any).index('secret'); // fuck type definition
|
||||
|
||||
export default collection;
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('appdata');
|
||||
export default db.get('appdata');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('auth_sessions');
|
||||
export default db.get('auth_sessions');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('drive_files');
|
||||
export default db.get('drive_files');
|
||||
|
||||
export function validateFileName(name: string): boolean {
|
||||
return (
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('drive_folders');
|
||||
export default db.get('drive_folders');
|
||||
|
||||
export function isValidFolderName(name: string): boolean {
|
||||
return (
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('drive_tags');
|
||||
export default db.get('drive_tags');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('favorites');
|
||||
export default db.get('favorites');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('following');
|
||||
export default db.get('following');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('likes');
|
||||
export default db.get('likes');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('messaging_histories');
|
||||
export default db.get('messaging_histories');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('messaging_messages');
|
||||
export default db.get('messaging_messages');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('notifications');
|
||||
export default db.get('notifications');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('posts');
|
||||
export default db.get('posts');
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
export default db.collection('signin');
|
||||
export default db.get('signin');
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import db from '../../db/mongodb';
|
||||
|
||||
const collection = db.collection('users');
|
||||
const collection = db.get('users');
|
||||
|
||||
collection.createIndex('username');
|
||||
collection.createIndex('token');
|
||||
(collection as any).index('username'); // fuck type definition
|
||||
(collection as any).index('token'); // fuck type definition
|
||||
|
||||
export default collection;
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ export default async (req: express.Request, res: express.Response) => {
|
|||
const secret = '!' + rndstr('a-zA-Z0-9', 32);
|
||||
|
||||
// Create account
|
||||
const inserted = await User.insert({
|
||||
const account = await User.insert({
|
||||
token: secret,
|
||||
avatar_id: null,
|
||||
banner_id: null,
|
||||
|
@ -77,8 +77,6 @@ export default async (req: express.Request, res: express.Response) => {
|
|||
username_lower: username.toLowerCase()
|
||||
});
|
||||
|
||||
const account = inserted.ops[0];
|
||||
|
||||
// Response
|
||||
res.send(await serialize(account));
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const mongo = require('mongoskin');
|
||||
import * as mongo from 'monk';
|
||||
|
||||
import config from '../conf';
|
||||
|
||||
|
@ -6,6 +6,6 @@ const uri = config.mongodb.user && config.mongodb.pass
|
|||
? `mongodb://${config.mongodb.user}:${config.mongodb.pass}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`
|
||||
: `mongodb://${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`;
|
||||
|
||||
const db = mongo.db(uri, { native_parser: true });
|
||||
const db = mongo(uri);
|
||||
|
||||
export default db;
|
||||
|
|
Loading…
Reference in a new issue