Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Cli.prototype._generateRegistration = function(appServiceUrl, localpart) {
if (!appServiceUrl) {
throw new Error("Missing app service URL");
}
var self = this;
var reg = new AppServiceRegistration(appServiceUrl);
if (localpart) {
reg.setSenderLocalpart(localpart);
}
this.opts.generateRegistration.bind(this)(reg, function(completeReg) {
reg = completeReg;
reg.outputAsYaml(self.opts.registrationPath);
console.log("Output registration to: " + self.opts.registrationPath);
process.exit(0);
});
};
generateRegistration: function(appServiceUrl, callback) {
var reg = new AppServiceRegistration(appServiceUrl);
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("vertobot");
reg.addRegexPattern("users", "@" + USER_PREFIX + ".*", true);
console.log(
"Generating registration to '%s' for the AS accessible from: %s",
REGISTRATION_FILE, appServiceUrl
);
callback(reg);
},
run: runBridge
generateRegistration: function(callback) {
var reg = new AppServiceRegistration("http://localhost:8008");
reg.setHomeserverToken(AppServiceRegistration.generateToken());
reg.setAppServiceToken(AppServiceRegistration.generateToken());
reg.setSenderLocalpart("bridge-example");
reg.addRegexPattern("users", "@example_.*", true);
console.log("Generating registration to 'my-bridge-registration.yaml'");
callback(reg);
}
});