diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-24 06:17:55 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-24 06:17:55 +0900 |
| commit | a136715111de5a7822b97d43681d20e494d43505 (patch) | |
| tree | c451210ecaca628d2c7bb953104710f2fa8569ff /src/services/register-instance.ts | |
| parent | Make max allowed text length configurable (#2992) (diff) | |
| download | misskey-a136715111de5a7822b97d43681d20e494d43505.tar.gz misskey-a136715111de5a7822b97d43681d20e494d43505.tar.bz2 misskey-a136715111de5a7822b97d43681d20e494d43505.zip | |
Implement #2993
Diffstat (limited to 'src/services/register-instance.ts')
| -rw-r--r-- | src/services/register-instance.ts | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/services/register-instance.ts b/src/services/register-instance.ts new file mode 100644 index 0000000000..6576a9ed06 --- /dev/null +++ b/src/services/register-instance.ts @@ -0,0 +1,22 @@ +import Instance, { IInstance } from '../models/instance'; +import federationChart from '../chart/federation'; + +export default async function(host: string): Promise<IInstance> { + if (host == null) return null; + + const index = await Instance.findOne({ host }); + + if (index == null) { + const i = await Instance.insert({ + host, + caughtAt: new Date(), + system: null // TODO + }); + + federationChart.update(true); + + return i; + } else { + return index; + } +} |