feat: use refreshtoken instead of api token
This commit is contained in:
@@ -148,10 +148,7 @@ export class ElevenLabsTTS implements TTSModule {
|
||||
}
|
||||
|
||||
canBeUsed(): boolean {
|
||||
return (
|
||||
config.tts_elevenlabs_refreshtoken != undefined &&
|
||||
config.tts_elevenlabs_key != undefined
|
||||
);
|
||||
return config.tts_elevenlabs_refreshtoken != undefined;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -176,13 +173,15 @@ export class ElevenLabsTTS implements TTSModule {
|
||||
}
|
||||
|
||||
private async fetchVoices(): Promise<void> {
|
||||
if (!this.session) return;
|
||||
|
||||
const opt: https.RequestOptions = {
|
||||
hostname: ELEVENLABS_API_ENDPOINT,
|
||||
path: '/v2/voices',
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'xi-api-key': config.tts_elevenlabs_key,
|
||||
Authorization: `Bearer ${this.session.idToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
@@ -211,13 +210,15 @@ export class ElevenLabsTTS implements TTSModule {
|
||||
}
|
||||
|
||||
private async fetchModels(): Promise<void> {
|
||||
if (!this.session) return;
|
||||
|
||||
const opt: https.RequestOptions = {
|
||||
hostname: ELEVENLABS_API_ENDPOINT,
|
||||
path: '/v1/models',
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'xi-api-key': config.tts_elevenlabs_key,
|
||||
Authorization: `Bearer ${this.session.idToken}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ export interface Config {
|
||||
tts_default_mode: string | undefined;
|
||||
tts_default_voice: string | undefined;
|
||||
|
||||
tts_elevenlabs_key: string | undefined;
|
||||
tts_elevenlabs_refreshtoken: string | undefined;
|
||||
tts_tiktok_sessionid: string | undefined;
|
||||
|
||||
@@ -30,7 +29,6 @@ function loadConfig(): Config {
|
||||
owner_id: process.env.DISCORD_OWNER_ID,
|
||||
tts_default_mode: process.env.DEFAULT_TTS_MODE,
|
||||
tts_default_voice: process.env.DEFAULT_TTS_VOICE,
|
||||
tts_elevenlabs_key: process.env.TTS_ELEVENLABS_KEY,
|
||||
tts_elevenlabs_refreshtoken: process.env.TTS_ELEVENLABS_REFRESHTOKEN,
|
||||
steam_webapi_key: process.env.STEAM_WEBAPI_KEY,
|
||||
aws_access_id: process.env.AWS_ACCESS_ID,
|
||||
|
||||
Reference in New Issue
Block a user