Use camelCase

This commit is contained in:
syuilo 2019-02-24 12:53:22 +09:00
parent 7874c4ed20
commit 0e5c9df3f5
16 changed files with 34 additions and 42 deletions

View file

@ -32,16 +32,12 @@ export default function load() {
mixin.host = url.host;
mixin.hostname = url.hostname;
mixin.scheme = url.protocol.replace(/:$/, '');
mixin.ws_scheme = mixin.scheme.replace('http', 'ws');
mixin.ws_url = `${mixin.ws_scheme}://${mixin.host}`;
mixin.api_url = `${mixin.scheme}://${mixin.host}/api`;
mixin.auth_url = `${mixin.scheme}://${mixin.host}/auth`;
mixin.dev_url = `${mixin.scheme}://${mixin.host}/dev`;
mixin.docs_url = `${mixin.scheme}://${mixin.host}/docs`;
mixin.stats_url = `${mixin.scheme}://${mixin.host}/stats`;
mixin.status_url = `${mixin.scheme}://${mixin.host}/status`;
mixin.drive_url = `${mixin.scheme}://${mixin.host}/files`;
mixin.user_agent = `Misskey/${pkg.version} (${config.url})`;
mixin.wsScheme = mixin.scheme.replace('http', 'ws');
mixin.wsUrl = `${mixin.wsScheme}://${mixin.host}`;
mixin.apiUrl = `${mixin.scheme}://${mixin.host}/api`;
mixin.authUrl = `${mixin.scheme}://${mixin.host}/auth`;
mixin.driveUrl = `${mixin.scheme}://${mixin.host}/files`;
mixin.userAgent = `Misskey/${pkg.version} (${config.url})`;
if (config.autoAdmin == null) config.autoAdmin = false;

View file

@ -49,16 +49,12 @@ export type Mixin = {
host: string;
hostname: string;
scheme: string;
ws_scheme: string;
api_url: string;
ws_url: string;
auth_url: string;
docs_url: string;
stats_url: string;
status_url: string;
dev_url: string;
drive_url: string;
user_agent: string;
wsScheme: string;
apiUrl: string;
wsUrl: string;
authUrl: string;
driveUrl: string;
userAgent: string;
};
export type Config = Source & Mixin;

View file

@ -14,9 +14,9 @@ export default function(file: IDriveFile, thumbnail = false): string {
}
} else {
if (thumbnail) {
return `${config.drive_url}/${file._id}?thumbnail`;
return `${config.driveUrl}/${file._id}?thumbnail`;
} else {
return `${config.drive_url}/${file._id}?web`;
return `${config.driveUrl}/${file._id}?web`;
}
}
}
@ -27,5 +27,5 @@ export function getOriginalUrl(file: IDriveFile) {
}
const accessKey = file.metadata ? file.metadata.accessKey : null;
return `${config.drive_url}/${file._id}${accessKey ? '?original=' + accessKey : ''}`;
return `${config.driveUrl}/${file._id}${accessKey ? '?original=' + accessKey : ''}`;
}

View file

@ -76,8 +76,8 @@ export const pack = (
}
_app.iconUrl = _app.icon != null
? `${config.drive_url}/${_app.icon}`
: `${config.drive_url}/app-default.jpg`;
? `${config.driveUrl}/${_app.icon}`
: `${config.driveUrl}/app-default.jpg`;
if (me) {
// 既に連携しているか

View file

@ -350,7 +350,7 @@ export const pack = (
}
if (_user.avatarUrl == null) {
_user.avatarUrl = `${config.drive_url}/default-avatar.jpg`;
_user.avatarUrl = `${config.driveUrl}/default-avatar.jpg`;
}
if (!meId || !meId.equals(_user.id) || !opts.detail) {

View file

@ -45,7 +45,7 @@ export default (user: ILocalUser, url: string, object: any) => new Promise(async
timeout,
headers: {
'Host': host,
'User-Agent': config.user_agent,
'User-Agent': config.userAgent,
'Content-Type': 'application/activity+json',
'Digest': `SHA-256=${hash}`
}

View file

@ -60,7 +60,7 @@ export default class Resolver {
proxy: config.proxy,
timeout: this.timeout,
headers: {
'User-Agent': config.user_agent,
'User-Agent': config.userAgent,
Accept: 'application/activity+json, application/ld+json'
},
json: true

View file

@ -52,6 +52,6 @@ export default define(meta, async (ps) => {
return {
token: doc.token,
url: `${config.auth_url}/${doc.token}`
url: `${config.authUrl}/${doc.token}`
};
});

View file

@ -73,12 +73,12 @@ export default define(meta, async (ps, user) => {
'metadata.deletedAt': { $exists: false }
});
} else if (ps.url) {
const isInternalStorageUrl = ps.url.startsWith(config.drive_url);
const isInternalStorageUrl = ps.url.startsWith(config.driveUrl);
if (isInternalStorageUrl) {
// Extract file ID from url
// e.g.
// http://misskey.local/files/foo?original=bar --> foo
const fileId = new mongo.ObjectID(ps.url.replace(config.drive_url, '').replace(/\?(.*)$/, '').replace(/\//g, ''));
const fileId = new mongo.ObjectID(ps.url.replace(config.driveUrl, '').replace(/\?(.*)$/, '').replace(/\//g, ''));
file = await DriveFile.findOne({
_id: fileId,
'metadata.deletedAt': { $exists: false }

View file

@ -25,7 +25,7 @@ export const description = `
#### 2.
使
[${config.api_url}/auth/session/generate](#operation/auth/session/generate) appSecret
[${config.apiUrl}/auth/session/generate](#operation/auth/session/generate) appSecret
JSONでPOSTです
URLが取得できるのでURLをブラウザで表示し
@ -35,7 +35,7 @@ export const description = `
URLを設定していない場合(())
#### 3.
[${config.api_url}/auth/session/userkey](#operation/auth/session/userkey)
[${config.apiUrl}/auth/session/userkey](#operation/auth/session/userkey)

View file

@ -23,7 +23,7 @@ export function genOpenapiSpec(lang = 'ja-JP') {
},
servers: [{
url: config.api_url
url: config.apiUrl
}],
paths: {} as any,

View file

@ -179,7 +179,7 @@ router.get('/dc/cb', async ctx => {
url: 'https://discordapp.com/api/users/@me',
headers: {
'Authorization': `Bearer ${accessToken}`,
'User-Agent': config.user_agent
'User-Agent': config.userAgent
}
}, (err, response, body) => {
if (err)
@ -263,7 +263,7 @@ router.get('/dc/cb', async ctx => {
url: 'https://discordapp.com/api/users/@me',
headers: {
'Authorization': `Bearer ${accessToken}`,
'User-Agent': config.user_agent
'User-Agent': config.userAgent
}
}, (err, response, body) => {
if (err)

View file

@ -171,7 +171,7 @@ router.get('/gh/cb', async ctx => {
headers: {
'Accept': 'application/vnd.github.v3+json',
'Authorization': `bearer ${accessToken}`,
'User-Agent': config.user_agent
'User-Agent': config.userAgent
}
}, (err, response, body) => {
if (err)
@ -234,7 +234,7 @@ router.get('/gh/cb', async ctx => {
headers: {
'Accept': 'application/vnd.github.v3+json',
'Authorization': `bearer ${accessToken}`,
'User-Agent': config.user_agent
'User-Agent': config.userAgent
}
}, (err, response, body) => {
if (err)

View file

@ -72,7 +72,7 @@ async function fetch(url: string, path: string) {
proxy: config.proxy,
timeout: 10 * 1000,
headers: {
'User-Agent': config.user_agent
'User-Agent': config.userAgent
}
});

View file

@ -79,13 +79,13 @@ router.get('/*/*', async ctx => {
showdown.extension('wsUrlExtension', () => ({
type: 'output',
regex: /%WS_URL%/g,
replace: config.ws_url
replace: config.wsUrl
}));
showdown.extension('apiUrlExtension', () => ({
type: 'output',
regex: /%API_URL%/g,
replace: config.api_url
replace: config.apiUrl
}));
const conv = new showdown.Converter({

View file

@ -58,7 +58,7 @@ export default async (
proxy: config.proxy,
timeout: 10 * 1000,
headers: {
'User-Agent': config.user_agent
'User-Agent': config.userAgent
}
});