Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
obsinfo() {
if (this.obsProps.streamStatus != null) {
const { fps, kbitsPerSec } = this.obsProps.streamStatus;
this.say(
format(this.locale.obsinfo.success, {
currentScene: this.obsProps.currentScene,
fps: Math.round(fps),
bitrate: kbitsPerSec
})
);
} else {
this.say(this.locale.obsinfo.error);
}
}
async switch(sceneName) {
if (sceneName == null) return this.say(this.locale.switch.error);
const res = search(sceneName, this.obsProps.scenes, { keySelector: obj => obj.name });
const scene = res.length > 0 ? res[0].name : sceneName;
try {
await this.obs.setCurrentScene({
"scene-name": scene
});
this.say(
format(this.locale.switch.success, {
scene
})
);
} catch (e) {
log.error(e);
this.say(e.error);
}
}
protected getTemplate (): string {
return format(DebugProtectionFunctionIntervalTemplate(), {
debugProtectionFunctionName: this.debugProtectionFunctionName
});
}
}
config.twitchChat.alias.map((arr, index) => {
if (arr[0] == alias) {
config.twitchChat.alias.splice(index);
delete this.aliases[alias];
this.handleWriteToConfig();
this.say(
format(this.locale.alias.removed, {
alias: alias
})
);
exists = true;
}
});
log.success(`Started recording`);
} catch (error) {
this.say(
format(`[REC] ${this.locale.rec.error}`, {
option: this.locale.rec.started
})
);
}
} else {
try {
const res = await this.obs.StopRecording();
if (res.status === "ok") this.say(`[REC] ${this.locale.rec.stopped}`);
log.success(`Stopped recording`);
} catch (error) {
this.say(
format(` [REC] ${this.locale.rec.error}`, {
option: this.locale.rec.stopped
})
);
}
}
}
protected getTemplate (): string {
const domainsString: string = this.options.domainLock.join(';');
const [hiddenDomainsString, diff]: string[] = this.cryptUtils.hideString(
domainsString,
domainsString.length * 3
);
const globalVariableTemplate: string = this.options.target !== ObfuscationTarget.BrowserNoEval
? this.getGlobalVariableTemplate()
: GlobalVariableNoEvalTemplate();
return format(DomainLockNodeTemplate(), {
domainLockFunctionName: this.identifierNamesGenerator.generate(),
diff: diff,
domains: hiddenDomainsString,
globalVariableTemplate,
singleNodeCallControllerFunctionName: this.callsControllerFunctionName
});
}
}
switch (this.options.stringArrayEncoding) {
case StringArrayEncoding.Rc4:
decodeStringArrayTemplate = format(
StringArrayRc4DecodeNodeTemplate(this.randomGenerator),
{
atobPolyfill,
rc4Polyfill: Rc4Template(),
selfDefendingCode,
stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
}
);
break;
case StringArrayEncoding.Base64:
decodeStringArrayTemplate = format(
StringArrayBase64DecodeNodeTemplate(this.randomGenerator),
{
atobPolyfill,
selfDefendingCode,
stringArrayCallsWrapperName: this.stringArrayCallsWrapperName
}
);
}
return decodeStringArrayTemplate;
}
}
export default action => {
const errors = {}, { error, payload } = action
if (error === true && payload.status !== 400) {
let message = errorMessages.unknown
if (payload && payload.statusText) {
const template = errorMessages.api[camelize(payload.statusText)]
if (template) {
message = errorMessages.unexpected + ' ' + template
}
}
else if (payload && payload.name && payload.message) {
const template = errorMessages.api[camelize(payload.name)]
if (template) {
message = format(template, payload)
const camelizedMessage = camelize(payload.message)
if (errorMessages.api[camelizedMessage])
message = errorMessages.unexpected + ' ' + errorMessages.api[camelizedMessage]
}
}
errors._error = message
}
return errors
}
init: function (dt, obj) {
var obj = this.context;
obj.parameters.text = format(obj.parameters.template, {
time: ((obj.layer.game.parameters.bestTime) / 60).toFixed(2)
});
}
},
export default (formInput, action, messages) => {
if (!action || !action.payload || !action.payload.errors) return undefined
const { errors } = action.payload
const _error = errorMessages.unexpected
if (!errors) return { _error }
const formErrors = {}
for (const field in errors) {
if (!errors.hasOwnProperty(field) || !errors[field] || !errors[field].reasonText) continue
const reason = camelize(errors[field].reasonText)
const tokens = { ...formInput }
if (!tokens[field]) tokens[field] = errors[field].value
let message = _error
if (messages && messages[field] && messages[field][reason]) {
message = format(messages[field][reason], tokens)
}
if (formInput && formInput.hasOwnProperty(field)) {
formErrors[field] = message
}
else if (!formErrors._error) {
formErrors._error = message
}
}
return formErrors
}