This commit is contained in:
syuilo 2018-10-24 06:17:55 +09:00
parent daa22d68fa
commit a136715111
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
5 changed files with 153 additions and 0 deletions

View file

@ -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;
}
}