Pleroma-compatible version string

Refs https://github.com/cloudflare/wildebeest/pull/70
pull/119/head
Sven Sauleau 2023-01-17 10:25:19 +00:00
rodzic c559bde6f7
commit efbeaf7dd4
6 zmienionych plików z 18 dodań i 8 usunięć

Wyświetl plik

@ -45,6 +45,7 @@ describe('Mastodon APIs', () => {
assert.equal(data.title, 'a')
assert.equal(data.email, 'b')
assert.equal(data.description, 'c')
assert(data.version.includes('Wildebeest'))
}
})
@ -82,6 +83,7 @@ describe('Mastodon APIs', () => {
assert.equal(data.title, 'a')
assert.equal(data.contact.email, 'b')
assert.equal(data.description, 'c')
assert(data.version.includes('Wildebeest'))
}
})
})

10
config/versions.ts 100644
Wyświetl plik

@ -0,0 +1,10 @@
import * as packagejson from '../package.json'
// https://github.com/mastodon/mastodon/blob/main/CHANGELOG.md
const MASTODON_API_VERSION = '4.0.2'
const WILDEBEEST_VERSION = packagejson.version
export function getVersion(): string {
return `${MASTODON_API_VERSION} (compatible; Wildebeest ${WILDEBEEST_VERSION})`
}

Wyświetl plik

@ -1,7 +1,6 @@
import type { Env } from 'wildebeest/backend/src/types/env'
import { DEFAULT_THUMBNAIL } from 'wildebeest/backend/src/config'
const INSTANCE_VERSION = '4.0.2'
import { getVersion } from 'wildebeest/config/versions'
export const onRequest: PagesFunction<Env, any> = async ({ env, request }) => {
const domain = new URL(request.url).hostname
@ -24,7 +23,7 @@ export async function handleRequest(domain: string, env: Env) {
// The documentation is incorrect and registrations is a boolean.
res.registrations = false
res.version = INSTANCE_VERSION
res.version = getVersion()
res.rules = []
res.uri = domain
res.title = env.INSTANCE_TITLE

Wyświetl plik

@ -1,8 +1,7 @@
import type { Env } from 'wildebeest/backend/src/types/env'
import { DEFAULT_THUMBNAIL } from 'wildebeest/backend/src/config'
import type { InstanceConfigV2 } from 'wildebeest/backend/src/types/configs'
const INSTANCE_VERSION = '4.0.2'
import { getVersion } from 'wildebeest/config/versions'
export const onRequest: PagesFunction<Env, any> = async ({ env, request }) => {
const domain = new URL(request.url).hostname
@ -19,7 +18,7 @@ export async function handleRequest(domain: string, db: D1Database, env: Env) {
const res: InstanceConfigV2 = {
domain,
title: env.INSTANCE_TITLE,
version: INSTANCE_VERSION,
version: getVersion(),
source_url: 'https://github.com/cloudflare/wildebeest',
description: env.INSTANCE_DESCR,
thumbnail: {

Wyświetl plik

@ -2,7 +2,7 @@
export default {
preset: 'ts-jest',
verbose: true,
testMatch: ["<rootDir>/(backend|consumer)/test/**/(*.)+(spec|test).[jt]s?(x)"],
testMatch: ['<rootDir>/(backend|consumer)/test/**/(*.)+(spec|test).[jt]s?(x)'],
testTimeout: 30000,
testEnvironment: 'miniflare',
// Configuration is automatically loaded from `.env`, `package.json` and

Wyświetl plik

@ -1,6 +1,6 @@
{
"name": "wildebeest",
"version": "0.0.0",
"version": "0.0.1",
"type": "module",
"author": "Sven Sauleau <sven@cloudflare.com>",
"devDependencies": {