Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
uri = path.basename(uri);
}
// Strip empty hash fragments: `#` `#/` `#!/`
if (/^#!?\/?$/.test(hash)) {
hash = '';
}
stream.filename = filename({
crop: options.crop ? '-cropped' : '',
date: easydate('Y-M-d'),
time: easydate('h-m-s'),
size,
width: sizes[0],
height: sizes[1],
url: filenamifyUrl(uri) + filenamify(hash)
});
if (options.incrementalName) {
stream.filename = unusedFilename.sync(stream.filename);
}
return stream;
}
const sizes = size.split('x');
const stream = screenshotStream(protocolify(uri), size, options);
const filename = template(`${options.filename}.${options.format}`);
if (path.isAbsolute(uri)) {
uri = path.basename(uri);
}
stream.filename = filename({
crop: options.crop ? '-cropped' : '',
date: easydate('Y-M-d'),
time: easydate('h-m-s'),
size,
width: sizes[0],
height: sizes[1],
url: filenamifyUrl(uri)
});
return stream;
}
extractedSeedWarcPath (seed, forCol) {
return path.join(
this._swapper.setValue(this._settings.get('collections.colWarcs')).template({col: forCol}, '{', '}').s,
`${filenamifyUrl(seed)}-${forCol}-${new Date().getTime()}.warc`
)
}
const archive = (forCol, config) => {
let message = `Archiving ${config.get('url')} for ${forCol} Now!`
let conf = config.get('config')
let rconf
if (conf.charAt(0) === 'p') {
let saveThisOne = `${filenamifyUrl(config.get('url'))}-${forCol}-${new Date().getTime()}.warc`
rconf = {
forCol,
jobId: uuidv1(),
type: conf,
uri_r: config.get('url'),
saveTo: path.join(S(settings.get('collections.colWarcs')).template({col: forCol}).s, saveThisOne),
isPartOfV: forCol,
description: `Archived by WAIL for ${forCol}`
}
ipc.send(ipcChannels.ARCHIVE_WITH_WAIL, rconf)
} else {
ipc.send(ipcChannels.ARCHIVE_WITH_HERITRIX, {
urls: config.get('url'),
depth: parseInt(conf[1]),
jobId: new Date().getTime(),
forCol
async _makeRepo(remote: RemoteConfig) {
let cacheDirectory = remote.cacheDir;
if (!cacheDirectory) {
cacheDirectory = join(tmpdir(), 'cardstack-git-local-cache');
if (!existsSync(cacheDirectory)) {
await mkdirp(cacheDirectory);
}
}
let repoPath = join(cacheDirectory, filenamifyUrl(remote.url));
let fetchOpts = {
callbacks: {
credentials: (url: string, userName: string) => {
if (remote.privateKey) {
return Cred.sshKeyMemoryNew(userName, remote.publicKey || '', remote.privateKey, remote.passphrase || '');
}
return Cred.sshKeyFromAgent(userName);
},
},
};
log.info('creating local repo cache for %s in %s', remote.url, repoPath);
let repo;