Skip to content

Commit

Permalink
addedimages
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander committed Nov 23, 2021
1 parent cb20ba5 commit 6ed89d8
Show file tree
Hide file tree
Showing 839 changed files with 13,212 additions and 12,772 deletions.
4 changes: 4 additions & 0 deletions config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ storage:
tmp: 'storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
avatars: 'storage/avatars/'
videos: 'storage/videos/'
images: 'storage/images/'
streaming_playlists: 'storage/streaming-playlists/'
redundancy: 'storage/redundancy/'
logs: 'storage/logs/'
Expand Down Expand Up @@ -172,6 +173,9 @@ redundancy:
# min_lifetime: '48 hours'
# strategy: 'recently-added' # Cache recently added videos
# min_views: 10 # Having at least x views
images:
check_interval: 120000 # How often you want to check new images to cache (in ms)
nb_images_per_req: 10

# Other instances that duplicate your content
remote_redundancy:
Expand Down
4 changes: 4 additions & 0 deletions config/production.yaml.example
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ storage:
tmp: '/var/www/peertube/storage/tmp/' # Use to download data (imports etc), store uploaded files before and during processing...
avatars: '/var/www/peertube/storage/avatars/'
videos: '/var/www/peertube/storage/videos/'
images: '/var/www/peertube/storage/images/'
streaming_playlists: '/var/www/peertube/storage/streaming-playlists/'
redundancy: '/var/www/peertube/storage/redundancy/'
logs: '/var/www/peertube/storage/logs/'
Expand Down Expand Up @@ -170,6 +171,9 @@ redundancy:
# min_lifetime: '48 hours'
# strategy: 'recently-added' # Cache recently added videos
# min_views: 10 # Having at least x views
images:
check_interval: 120000 # How often you want to check new images to cache (in ms)
nb_images_per_req: 10

# Other instances that duplicate your content
remote_redundancy:
Expand Down
1 change: 1 addition & 0 deletions config/test-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ storage:
tmp: 'test1/tmp/'
avatars: 'test1/avatars/'
videos: 'test1/videos/'
images: 'test1/images/'
streaming_playlists: 'test1/streaming-playlists/'
redundancy: 'test1/redundancy/'
logs: 'test1/logs/'
Expand Down
1 change: 1 addition & 0 deletions config/test-2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ storage:
tmp: 'test2/tmp/'
avatars: 'test2/avatars/'
videos: 'test2/videos/'
images: 'test2/images/'
streaming_playlists: 'test2/streaming-playlists/'
redundancy: 'test2/redundancy/'
logs: 'test2/logs/'
Expand Down
1 change: 1 addition & 0 deletions config/test-3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ storage:
tmp: 'test3/tmp/'
avatars: 'test3/avatars/'
videos: 'test3/videos/'
images: 'test3/images/'
streaming_playlists: 'test3/streaming-playlists/'
redundancy: 'test3/redundancy/'
logs: 'test3/logs/'
Expand Down
1 change: 1 addition & 0 deletions config/test-4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ storage:
tmp: 'test4/tmp/'
avatars: 'test4/avatars/'
videos: 'test4/videos/'
images: 'test4/images/'
streaming_playlists: 'test4/streaming-playlists/'
redundancy: 'test4/redundancy/'
logs: 'test4/logs/'
Expand Down
1 change: 1 addition & 0 deletions config/test-5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ storage:
tmp: 'test5/tmp/'
avatars: 'test5/avatars/'
videos: 'test5/videos/'
images: 'test5/images/'
streaming_playlists: 'test5/streaming-playlists/'
redundancy: 'test5/redundancy/'
logs: 'test5/logs/'
Expand Down
1 change: 1 addition & 0 deletions config/test-6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ storage:
tmp: 'test6/tmp/'
avatars: 'test6/avatars/'
videos: 'test6/videos/'
images: 'test6/images/'
streaming_playlists: 'test6/streaming-playlists/'
redundancy: 'test6/redundancy/'
logs: 'test6/logs/'
Expand Down
20 changes: 10 additions & 10 deletions dist/scripts/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const register_ts_paths_1 = require("../server/helpers/register-ts-paths");
register_ts_paths_1.registerTSPaths();
const autocannon_1 = tslib_1.__importStar(require("autocannon"));
(0, register_ts_paths_1.registerTSPaths)();
const autocannon_1 = (0, tslib_1.__importStar)(require("autocannon"));
const fs_extra_1 = require("fs-extra");
const extra_utils_1 = require("@shared/extra-utils");
let server;
Expand All @@ -14,7 +14,7 @@ run()
.catch(err => console.error(err))
.finally(() => {
if (server)
return extra_utils_1.killallServers([server]);
return (0, extra_utils_1.killallServers)([server]);
});
function buildAuthorizationHeader() {
return {
Expand All @@ -27,7 +27,7 @@ function buildAPHeader() {
};
}
function run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
console.log('Preparing server...');
yield prepare();
const tests = [
Expand Down Expand Up @@ -140,16 +140,16 @@ function run() {
const testResult = yield runBenchmark(test);
Object.assign(testResult, { title: test.title, path: test.path });
finalResult.push(testResult);
console.log(autocannon_1.printResult(testResult));
console.log((0, autocannon_1.printResult)(testResult));
}
if (outfile)
yield fs_extra_1.writeJson(outfile, finalResult);
yield (0, fs_extra_1.writeJson)(outfile, finalResult);
});
}
function runBenchmark(options) {
const { path, expecter, headers } = options;
return new Promise((res, rej) => {
autocannon_1.default({
(0, autocannon_1.default)({
url: server.url + path,
connections: 20,
headers,
Expand All @@ -173,15 +173,15 @@ function runBenchmark(options) {
});
}
function prepare() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
server = yield extra_utils_1.createSingleServer(1, {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
server = yield (0, extra_utils_1.createSingleServer)(1, {
rates_limit: {
api: {
max: 5000000
}
}
});
yield extra_utils_1.setAccessTokensToServers([server]);
yield (0, extra_utils_1.setAccessTokensToServers)([server]);
const attributes = {
name: 'my super video',
category: 2,
Expand Down
16 changes: 8 additions & 8 deletions dist/scripts/client-build-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const register_ts_paths_1 = require("../server/helpers/register-ts-paths");
register_ts_paths_1.registerTSPaths();
(0, register_ts_paths_1.registerTSPaths)();
const fs_extra_1 = require("fs-extra");
const path_1 = require("path");
const core_utils_1 = require("@server/helpers/core-utils");
function run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const result = {
app: yield buildResult(path_1.join(core_utils_1.root(), 'client', 'dist', 'en-US')),
embed: yield buildResult(path_1.join(core_utils_1.root(), 'client', 'dist', 'standalone', 'videos'))
app: yield buildResult((0, path_1.join)((0, core_utils_1.root)(), 'client', 'dist', 'en-US')),
embed: yield buildResult((0, path_1.join)((0, core_utils_1.root)(), 'client', 'dist', 'standalone', 'videos'))
};
console.log(JSON.stringify(result));
});
}
run()
.catch(err => console.error(err));
function buildResult(path) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const distFiles = yield fs_extra_1.readdir(path);
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const distFiles = yield (0, fs_extra_1.readdir)(path);
const files = [];
for (const file of distFiles) {
const filePath = path_1.join(path, file);
const statsResult = yield fs_extra_1.stat(filePath);
const filePath = (0, path_1.join)(path, file);
const statsResult = yield (0, fs_extra_1.stat)(filePath);
files.push({
name: file,
size: statsResult.size
Expand Down
12 changes: 6 additions & 6 deletions dist/scripts/create-import-video-file-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const register_ts_paths_1 = require("../server/helpers/register-ts-paths");
register_ts_paths_1.registerTSPaths();
(0, register_ts_paths_1.registerTSPaths)();
const commander_1 = require("commander");
const path_1 = require("path");
const video_1 = require("../server/models/video/video");
Expand All @@ -26,10 +26,10 @@ run()
process.exit(-1);
});
function run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield database_1.initDatabaseModels(true);
const uuid = misc_1.toCompleteUUID(options.video);
if (misc_1.isUUIDValid(uuid) === false) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
yield (0, database_1.initDatabaseModels)(true);
const uuid = (0, misc_1.toCompleteUUID)(options.video);
if ((0, misc_1.isUUIDValid)(uuid) === false) {
console.error('%s is not a valid video UUID.', options.video);
return;
}
Expand All @@ -40,7 +40,7 @@ function run() {
throw new Error('Cannot import files of a non owned video.');
const dataInput = {
videoUUID: video.uuid,
filePath: path_1.resolve(options.import)
filePath: (0, path_1.resolve)(options.import)
};
job_queue_1.JobQueue.Instance.init();
yield job_queue_1.JobQueue.Instance.createJobWithPromise({ type: 'video-file-import', payload: dataInput });
Expand Down
14 changes: 7 additions & 7 deletions dist/scripts/create-transcoding-job.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const register_ts_paths_1 = require("../server/helpers/register-ts-paths");
register_ts_paths_1.registerTSPaths();
(0, register_ts_paths_1.registerTSPaths)();
const commander_1 = require("commander");
const video_1 = require("../server/models/video/video");
const database_1 = require("../server/initializers/database");
Expand Down Expand Up @@ -32,10 +32,10 @@ run()
process.exit(-1);
});
function run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield database_1.initDatabaseModels(true);
const uuid = misc_1.toCompleteUUID(options.video);
if (misc_1.isUUIDValid(uuid) === false) {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
yield (0, database_1.initDatabaseModels)(true);
const uuid = (0, misc_1.toCompleteUUID)(options.video);
if ((0, misc_1.isUUIDValid)(uuid) === false) {
console.error('%s is not a valid video UUID.', options.video);
return;
}
Expand All @@ -47,7 +47,7 @@ function run() {
if (options.generateHls || config_1.CONFIG.TRANSCODING.WEBTORRENT.ENABLED === false) {
const resolutionsEnabled = options.resolution
? [options.resolution]
: ffprobe_utils_1.computeResolutionsToTranscode(resolution, 'vod').concat([resolution]);
: (0, ffprobe_utils_1.computeResolutionsToTranscode)(resolution, 'vod').concat([resolution]);
for (const resolution of resolutionsEnabled) {
dataInput.push({
type: 'new-resolution-to-hls',
Expand Down Expand Up @@ -85,7 +85,7 @@ function run() {
video.state = 2;
yield video.save();
for (const d of dataInput) {
yield video_2.addTranscodingJob(d, {});
yield (0, video_2.addTranscodingJob)(d, {});
console.log('Transcoding job for video %s created.', video.uuid);
}
});
Expand Down
6 changes: 3 additions & 3 deletions dist/scripts/generate-code-contributors.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const register_ts_paths_1 = require("../server/helpers/register-ts-paths");
register_ts_paths_1.registerTSPaths();
(0, register_ts_paths_1.registerTSPaths)();
const extra_utils_1 = require("@shared/extra-utils");
run()
.then(() => process.exit(0))
Expand All @@ -11,7 +11,7 @@ run()
process.exit(-1);
});
function run() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const blacklist = getContributorsBlacklist();
{
let contributors = yield getGitContributors();
Expand Down Expand Up @@ -50,7 +50,7 @@ function run() {
});
}
function getGitContributors() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const output = yield extra_utils_1.CLICommand.exec(`git --no-pager shortlog -sn < /dev/tty | sed 's/^\\s\\+[0-9]\\+\\s\\+//g'`);
return output.split('\n')
.filter(l => !!l)
Expand Down
36 changes: 18 additions & 18 deletions dist/scripts/i18n/create-custom-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const path_1 = require("path");
const register_ts_paths_1 = require("../../server/helpers/register-ts-paths");
const constants_1 = require("../../server/initializers/constants");
const i18n_1 = require("../../shared/core-utils/i18n");
register_ts_paths_1.registerTSPaths();
const videojs = require(path_1.join(__dirname, '../../../client/src/locale/videojs.en-US.json'));
(0, register_ts_paths_1.registerTSPaths)();
const videojs = require((0, path_1.join)(__dirname, '../../../client/src/locale/videojs.en-US.json'));
const playerKeys = {
'Quality': 'Quality',
'Auto': 'Auto',
Expand Down Expand Up @@ -47,13 +47,13 @@ const playerKeys = {
};
Object.assign(playerKeys, videojs);
const serverKeys = {};
lodash_1.values(constants_1.VIDEO_CATEGORIES)
.concat(lodash_1.values(constants_1.VIDEO_LICENCES))
.concat(lodash_1.values(constants_1.VIDEO_PRIVACIES))
.concat(lodash_1.values(constants_1.VIDEO_STATES))
.concat(lodash_1.values(constants_1.VIDEO_IMPORT_STATES))
.concat(lodash_1.values(constants_1.VIDEO_PLAYLIST_PRIVACIES))
.concat(lodash_1.values(constants_1.VIDEO_PLAYLIST_TYPES))
(0, lodash_1.values)(constants_1.VIDEO_CATEGORIES)
.concat((0, lodash_1.values)(constants_1.VIDEO_LICENCES))
.concat((0, lodash_1.values)(constants_1.VIDEO_PRIVACIES))
.concat((0, lodash_1.values)(constants_1.VIDEO_STATES))
.concat((0, lodash_1.values)(constants_1.VIDEO_IMPORT_STATES))
.concat((0, lodash_1.values)(constants_1.VIDEO_PLAYLIST_PRIVACIES))
.concat((0, lodash_1.values)(constants_1.VIDEO_PLAYLIST_TYPES))
.concat([
'This video does not exist.',
'We cannot fetch the video. Please try again later.',
Expand All @@ -71,27 +71,27 @@ Object.assign(serverKeys, {
Unknown: 'Unknown'
});
const languageKeys = {};
const languages = constants_1.buildLanguages();
const languages = (0, constants_1.buildLanguages)();
Object.keys(languages).forEach(k => { languageKeys[languages[k]] = languages[k]; });
Object.assign(serverKeys, languageKeys);
writeAll().catch(err => {
console.error(err);
process.exit(-1);
});
function writeAll() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const localePath = path_1.join(__dirname, '../../../client/src/locale');
yield fs_extra_1.writeJSON(path_1.join(localePath, 'player.en-US.json'), playerKeys, { spaces: 4 });
yield fs_extra_1.writeJSON(path_1.join(localePath, 'server.en-US.json'), serverKeys, { spaces: 4 });
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const localePath = (0, path_1.join)(__dirname, '../../../client/src/locale');
yield (0, fs_extra_1.writeJSON)((0, path_1.join)(localePath, 'player.en-US.json'), playerKeys, { spaces: 4 });
yield (0, fs_extra_1.writeJSON)((0, path_1.join)(localePath, 'server.en-US.json'), serverKeys, { spaces: 4 });
for (const key of Object.keys(i18n_1.I18N_LOCALES)) {
const playerJsonPath = path_1.join(localePath, `player.${key}.json`);
const playerJsonPath = (0, path_1.join)(localePath, `player.${key}.json`);
const translatedPlayer = require(playerJsonPath);
const newTranslatedPlayer = Object.assign({}, playerKeys, translatedPlayer);
yield fs_extra_1.writeJSON(playerJsonPath, newTranslatedPlayer, { spaces: 4 });
const serverJsonPath = path_1.join(localePath, `server.${key}.json`);
yield (0, fs_extra_1.writeJSON)(playerJsonPath, newTranslatedPlayer, { spaces: 4 });
const serverJsonPath = (0, path_1.join)(localePath, `server.${key}.json`);
const translatedServer = require(serverJsonPath);
const newTranslatedServer = Object.assign({}, serverKeys, translatedServer);
yield fs_extra_1.writeJSON(serverJsonPath, newTranslatedServer, { spaces: 4 });
yield (0, fs_extra_1.writeJSON)(serverJsonPath, newTranslatedServer, { spaces: 4 });
}
});
}
Loading

0 comments on commit 6ed89d8

Please sign in to comment.