mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-25 18:55:32 -06:00
server: serve files from storage/well-known (#5214)
* server: serve files from storage/well-known closes #5206 * well-known: add tests * test: try to skip new tests * test: another try * fix(config/prod): well_known path * test: fix broken tests * Update misc-endpoints.ts * Use getDirectoryPath for tests * Fix tests Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
|
||||
import { expect } from 'chai'
|
||||
import { pathExists, readdir } from 'fs-extra'
|
||||
import { join } from 'path'
|
||||
import { root } from '@shared/core-utils'
|
||||
import { Account, VideoChannel } from '@shared/models'
|
||||
import { PeerTubeServer } from '@shared/server-commands'
|
||||
|
||||
@@ -31,11 +29,9 @@ async function expectAccountFollows (options: {
|
||||
return expectActorFollow({ ...options, data })
|
||||
}
|
||||
|
||||
async function checkActorFilesWereRemoved (filename: string, serverNumber: number) {
|
||||
const testDirectory = 'test' + serverNumber
|
||||
|
||||
async function checkActorFilesWereRemoved (filename: string, server: PeerTubeServer) {
|
||||
for (const directory of [ 'avatars' ]) {
|
||||
const directoryPath = join(root(), testDirectory, directory)
|
||||
const directoryPath = server.getDirectoryPath(directory)
|
||||
|
||||
const directoryExists = await pathExists(directoryPath)
|
||||
expect(directoryExists).to.be.true
|
||||
|
||||
@@ -2,22 +2,18 @@
|
||||
|
||||
import { expect } from 'chai'
|
||||
import { pathExists, readdir } from 'fs-extra'
|
||||
import { join } from 'path'
|
||||
import { root } from '@shared/core-utils'
|
||||
import { PeerTubeServer } from '@shared/server-commands'
|
||||
|
||||
async function checkTmpIsEmpty (server: PeerTubeServer) {
|
||||
await checkDirectoryIsEmpty(server, 'tmp', [ 'plugins-global.css', 'hls', 'resumable-uploads' ])
|
||||
|
||||
if (await pathExists(join('test' + server.internalServerNumber, 'tmp', 'hls'))) {
|
||||
if (await pathExists(server.getDirectoryPath('tmp/hls'))) {
|
||||
await checkDirectoryIsEmpty(server, 'tmp/hls')
|
||||
}
|
||||
}
|
||||
|
||||
async function checkDirectoryIsEmpty (server: PeerTubeServer, directory: string, exceptions: string[] = []) {
|
||||
const testDirectory = 'test' + server.internalServerNumber
|
||||
|
||||
const directoryPath = join(root(), testDirectory, directory)
|
||||
const directoryPath = server.getDirectoryPath(directory)
|
||||
|
||||
const directoryExists = await pathExists(directoryPath)
|
||||
expect(directoryExists).to.be.true
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import { expect } from 'chai'
|
||||
import { readdir } from 'fs-extra'
|
||||
import { join } from 'path'
|
||||
import { root } from '@shared/core-utils'
|
||||
import { PeerTubeServer } from '@shared/server-commands'
|
||||
|
||||
async function checkPlaylistFilesWereRemoved (
|
||||
playlistUUID: string,
|
||||
internalServerNumber: number,
|
||||
server: PeerTubeServer,
|
||||
directories = [ 'thumbnails' ]
|
||||
) {
|
||||
const testDirectory = 'test' + internalServerNumber
|
||||
|
||||
for (const directory of directories) {
|
||||
const directoryPath = join(root(), testDirectory, directory)
|
||||
const directoryPath = server.getDirectoryPath(directory)
|
||||
|
||||
const files = await readdir(directoryPath)
|
||||
for (const file of files) {
|
||||
|
||||
Reference in New Issue
Block a user