Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor() {
this.log = Container.get(Logger).for(this);
const appConfig = Container.get>(AppConfig);
this.dev = appConfig.env === ENV_DEV;
this.options = appConfig.static;
// warmup lib
for (const [key, fn] of Object.entries(this.options)) {
this._paths.push(key);
const raw = this.content[key] = readSync(fn);
const size = Math.round(raw.length / 1024)
this.log.info(`Loaded static file: ${key}/${fn} ${size}kb`)
}
}
constructor() {
this.log = Container.get(Logger).for(this);
const appConfig = Container.get>(AppConfig);
this.dev = appConfig.env === ENV_DEV;
this.options = appConfig.static;
// warmup lib
for (const [key, fn] of Object.entries(this.options)) {
this._paths.push(key);
const raw = this.content[key] = readSync(fn);
const size = Math.round(raw.length / 1024)
this.log.info(`Loaded static file: ${key}/${fn} ${size}kb`)
}
}
promiseIpc.on("get-series", () => Container.get(MediaRepository).getSeries());
promiseIpc.on("get-episodes", (payload) => Container.get(MediaRepository).getEpisodes(payload));
(url, options) => {
const powerpackService = Container.get(IPowerpackService);
return {
url,
options: {
...options,
headers: {
...options.headers,
token: powerpackService.accessToken || '',
locale: localStorageService.get(LOCAL_USER_PREFERENCE_LOCALE_KEY, getLanguage()),
},
},
};
},
{ global: false }
Container.registerHandler({ object, index, propertyName, value: () => {
const connectionManager = Container.get(ConnectionManager);
if (!connectionManager.has(connectionName))
throw new Error(`Cannot get connection "${connectionName}" from the connection manager. ` +
`Make sure you have created such connection. Also make sure you have called useContainer(Container) ` +
`in your application before you established a connection and importing any entity.`);
const connection = connectionManager.get(connectionName);
const entityManager = connection.manager;
if (!entityManager)
throw new Error(`Entity manager was not found on "${connectionName}" connection. ` +
`Make sure you correctly setup connection and container usage.`);
return entityManager;
}});
};
promiseIpc.on("get-all-users", () => Container.get(UserRepository).getAllUsers());
promiseIpc.on("get-all-torrents", () => Container.get(TorrentsRepository).getAllTorrents());
this.server = await ProxyServer.create();
this.ignorer = new Ignorer();
this.server.use(this.ignorer.middleware.bind(this.ignorer));
this.server.use(ip());
this.server.use(user(Container.get(ProfileService)));
this.server.use(endPoint(Container.get(HttpTrafficService)));
this.server.use(
rule({
mockDataService: Container.get(MockDataService),
profileService: Container.get(ProfileService),
ruleService: Container.get(RuleService),
}),
);
const pluginManager: PluginManager = Container.get(PluginManager);
pluginManager.loadProxyMiddleware(this.server);
this.server.use(host(Container.get(HostService), Container.get(ProfileService)));
this.server.use(actualRequest(Container.get(HttpTrafficService)));
}
}
context.subscriptions.push(
languages.registerCompletionItemProvider(
SUPPORT_LANGUAGE,
Container.get(LocaleKeyCompletionItemProvider),
'=',
' ',
':'
)
);
context.subscriptions.push(
languages.registerDefinitionProvider(SUPPORT_LANGUAGE, Container.get(LocaleDefinitionProvider))
);
context.subscriptions.push(
languages.registerReferenceProvider(SUPPORT_LANGUAGE, Container.get(ModelActionReference))
);
context.subscriptions.push(Container.get(UmircDecoration));
context.subscriptions.push(Container.get(ModelEffectsGenerator));
}