aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/pleroma/index.js
blob: 67a0e190c170772b39821f6a73e430ec8bc574b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module.exports = Ferdium => class Pleroma extends Ferdium {
  async validateUrl(url) {
    try {
      const resp = await window.fetch(`${url}/api/v1/instance`, {
        Accept: 'application/json',
      });
      const data = await resp.json();
      const version = data.version;
      return typeof (version) === 'string' && version.includes('Pleroma');
    } catch (error) {
      console.log('Pleroma server validation error', error);
    }
    return false;
  }

  buildUrl(url) {
    return `${url}/main/friends`;
  }
};