avancement planning
This commit is contained in:
+5
@@ -23,9 +23,11 @@ const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const tuf_js_1 = require("tuf-js");
|
||||
const _1 = require(".");
|
||||
const package_json_1 = require("../package.json");
|
||||
const target_1 = require("./target");
|
||||
const TARGETS_DIR_NAME = 'targets';
|
||||
class TUFClient {
|
||||
updater;
|
||||
constructor(options) {
|
||||
const url = new URL(options.mirrorURL);
|
||||
const repoName = encodeURIComponent(url.host + url.pathname.replace(/\/$/, ''));
|
||||
@@ -63,6 +65,7 @@ function initTufCache(cachePath) {
|
||||
if (!fs_1.default.existsSync(cachePath)) {
|
||||
fs_1.default.mkdirSync(cachePath, { recursive: true });
|
||||
}
|
||||
/* istanbul ignore else */
|
||||
if (!fs_1.default.existsSync(targetsPath)) {
|
||||
fs_1.default.mkdirSync(targetsPath);
|
||||
}
|
||||
@@ -74,6 +77,7 @@ function seedCache({ cachePath, mirrorURL, tufRootPath, forceInit, }) {
|
||||
const cachedRootPath = path_1.default.join(cachePath, 'root.json');
|
||||
// If the root.json file does not exist (or we're forcing re-initialization),
|
||||
// populate it either from the supplied rootPath or from one of the repo seeds.
|
||||
/* istanbul ignore else */
|
||||
if (!fs_1.default.existsSync(cachedRootPath) || forceInit) {
|
||||
if (tufRootPath) {
|
||||
fs_1.default.copyFileSync(tufRootPath, cachedRootPath);
|
||||
@@ -99,6 +103,7 @@ function initClient(options) {
|
||||
const config = {
|
||||
fetchTimeout: options.timeout,
|
||||
fetchRetry: options.retry,
|
||||
userAgent: `${encodeURIComponent(package_json_1.name)}/${package_json_1.version}`,
|
||||
};
|
||||
return new tuf_js_1.Updater({
|
||||
metadataBaseUrl: options.mirrorURL,
|
||||
|
||||
Reference in New Issue
Block a user