Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

サードパーティがエンジンへのアクセス情報を得るための設定書き出し機能 #1765

Merged
merged 21 commits into from
Feb 13, 2024
Merged
Changes from 12 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0972e5e
未対応エンジン追加時にリストが消える件(#1168)
nmori Feb 5, 2023
cb5552c
lintチェックエラー部分の修正
nmori Feb 5, 2023
00b7673
コードレビューの反映 (ref #1179)
nmori Feb 5, 2023
4b21b85
コードレビュー分の反映② ref #1179
nmori Feb 5, 2023
ad8c1de
Merge branch 'main' of https://github.com/voicevox/voicevox
nmori Feb 9, 2023
6e91471
* コンフリクトの修正
nmori Feb 10, 2023
4e8cde0
Merge branch 'main' of https://github.com/voicevox/voicevox
nmori Feb 11, 2023
3ce28d9
Merge branch 'main' of https://github.com/VOICEVOX/voicevox
nmori Feb 18, 2023
a72f3b7
Merge branch 'main' of https://github.com/VOICEVOX/voicevox
nmori Feb 20, 2023
aac80a5
Merge branch 'main' of https://github.com/VOICEVOX/voicevox
nmori Feb 23, 2023
a37c7a2
Merge branch 'main' of https://github.com/VOICEVOX/voicevox
nmori Jan 26, 2024
80008bc
サードパーティがエンジンへのアクセス情報を得るための設定書き出し機能(ref #1738)
nmori Jan 26, 2024
351a3ab
* 関数名の変更 : writeEngineInfoFor3rdParty
nmori Jan 27, 2024
7cff6f0
* コンストラクタ引数でファイルパスを渡すように
nmori Jan 30, 2024
c93a819
* エクスポートファイパスを渡す所を引数にした
nmori Feb 1, 2024
af2cad2
議論 #1738 に基づき、最小項目の書き出しに変更
nmori Feb 8, 2024
94d56f8
* ファイル書き出しクラスに機能を集約
nmori Feb 12, 2024
a824ee3
RuntimeInfoManager.tsをブラッシュアップ
Hiroshiba Feb 13, 2024
437c87e
EngineManagerとRuntimeInfoManagerを疎結合に
Hiroshiba Feb 13, 2024
ddfda40
データ構造調整、テスト追加
Hiroshiba Feb 13, 2024
762bc6a
Apply suggestions from code review
Hiroshiba Feb 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/background/engineManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ export class EngineManager {
log.info(`ENGINE ${engineInfo.uuid}: Start launching`);
await this.runEngine(engineInfo.uuid);
}

await this.makeEngineInfoFor3rdParty();
}

/**
Expand Down Expand Up @@ -469,6 +471,7 @@ export class EngineManager {
);

this.runEngine(engineId);
this.makeEngineInfoFor3rdParty();
Hiroshiba marked this conversation as resolved.
Show resolved Hide resolved
resolve();
return;
}
Expand All @@ -482,6 +485,7 @@ export class EngineManager {
log.info(`ENGINE ${engineId}: Process killed. Restarting process...`);

this.runEngine(engineId);
this.makeEngineInfoFor3rdParty();
resolve();
};

Expand Down Expand Up @@ -544,6 +548,41 @@ export class EngineManager {
}
return "ok";
}

/**
* サードパーティ向けの設定ファイルを書き出す
*/
async makeEngineInfoFor3rdParty() {
nmori marked this conversation as resolved.
Show resolved Hide resolved
const exportEngineInfoFilename = path.join(
app.getPath("userData"),
"runtime-info.json"
);
const engineInfos = this.fetchEngineInfos();

log.info(`Update list of engines...` + exportEngineInfoFilename);

const engineInfoList = engineInfos.map((engineInfo) => {
return {
uuid: engineInfo.uuid,
host: engineInfo.host,
name: engineInfo.name,
path: engineInfo.path,
executionEnabled: engineInfo.executionEnabled,
executionFilePath: engineInfo.executionFilePath,
executionArgs: engineInfo.executionArgs,
type: engineInfo.type,
};
});

try {
fs.writeFileSync(
exportEngineInfoFilename,
JSON.stringify(engineInfoList)
);
nmori marked this conversation as resolved.
Show resolved Hide resolved
} catch (e) {
return "failedToWriteFile";
nmori marked this conversation as resolved.
Show resolved Hide resolved
}
}
}

export default EngineManager;
Loading