Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
bit-pm
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
燕伟桐
bit-pm
Commits
09b3bf3f
提交
09b3bf3f
authored
4月 21, 2025
作者:
Will Chen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prompt user to move to applications folder on first run
上级
d8b52a5d
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
38 行增加
和
1 行删除
+38
-1
schemas.ts
src/lib/schemas.ts
+1
-0
main.ts
src/main.ts
+36
-1
settings.ts
src/main/settings.ts
+1
-0
没有找到文件。
src/lib/schemas.ts
浏览文件 @
09b3bf3f
...
@@ -91,6 +91,7 @@ export const UserSettingsSchema = z.object({
...
@@ -91,6 +91,7 @@ export const UserSettingsSchema = z.object({
autoApproveChanges
:
z
.
boolean
().
optional
(),
autoApproveChanges
:
z
.
boolean
().
optional
(),
telemetryConsent
:
z
.
enum
([
"opted_in"
,
"opted_out"
,
"unset"
]).
optional
(),
telemetryConsent
:
z
.
enum
([
"opted_in"
,
"opted_out"
,
"unset"
]).
optional
(),
telemetryUserId
:
z
.
string
().
optional
(),
telemetryUserId
:
z
.
string
().
optional
(),
hasRunBefore
:
z
.
boolean
().
optional
(),
// DEPRECATED.
// DEPRECATED.
runtimeMode
:
RuntimeModeSchema
.
optional
(),
runtimeMode
:
RuntimeModeSchema
.
optional
(),
});
});
...
...
src/main.ts
浏览文件 @
09b3bf3f
import
{
app
,
BrowserWindow
}
from
"electron"
;
import
{
app
,
BrowserWindow
,
dialog
}
from
"electron"
;
import
*
as
path
from
"node:path"
;
import
*
as
path
from
"node:path"
;
import
{
registerIpcHandlers
}
from
"./ipc/ipc_host"
;
import
{
registerIpcHandlers
}
from
"./ipc/ipc_host"
;
import
dotenv
from
"dotenv"
;
import
dotenv
from
"dotenv"
;
...
@@ -6,6 +6,7 @@ import dotenv from "dotenv";
...
@@ -6,6 +6,7 @@ import dotenv from "dotenv";
import
started
from
"electron-squirrel-startup"
;
import
started
from
"electron-squirrel-startup"
;
import
{
updateElectronApp
}
from
"update-electron-app"
;
import
{
updateElectronApp
}
from
"update-electron-app"
;
import
log
from
"electron-log"
;
import
log
from
"electron-log"
;
import
{
readSettings
,
writeSettings
}
from
"./main/settings"
;
log
.
errorHandler
.
startCatching
();
log
.
errorHandler
.
startCatching
();
log
.
eventLogger
.
startLogging
();
log
.
eventLogger
.
startLogging
();
...
@@ -24,6 +25,40 @@ if (started) {
...
@@ -24,6 +25,40 @@ if (started) {
app
.
quit
();
app
.
quit
();
}
}
/**
* Is this the first run of Fiddle? If so, perform
* tasks that we only want to do in this case.
*/
export
async
function
onFirstRunMaybe
()
{
const
settings
=
readSettings
();
if
(
!
settings
.
hasRunBefore
)
{
await
promptMoveToApplicationsFolder
();
writeSettings
({
hasRunBefore
:
true
,
});
}
}
/**
* Ask the user if the app should be moved to the
* applications folder.
*/
async
function
promptMoveToApplicationsFolder
():
Promise
<
void
>
{
if
(
process
.
platform
!==
"darwin"
)
return
;
if
(
app
.
isInApplicationsFolder
())
return
;
const
{
response
}
=
await
dialog
.
showMessageBox
({
type
:
"question"
,
buttons
:
[
"Move to Applications Folder"
,
"Do Not Move"
],
defaultId
:
0
,
message
:
"Move to Applications Folder? (required for auto-update)"
,
});
if
(
response
===
0
)
{
app
.
moveToApplicationsFolder
();
}
}
declare
global
{
declare
global
{
const
MAIN_WINDOW_VITE_DEV_SERVER_URL
:
string
;
const
MAIN_WINDOW_VITE_DEV_SERVER_URL
:
string
;
}
}
...
...
src/main/settings.ts
浏览文件 @
09b3bf3f
...
@@ -15,6 +15,7 @@ const DEFAULT_SETTINGS: UserSettings = {
...
@@ -15,6 +15,7 @@ const DEFAULT_SETTINGS: UserSettings = {
providerSettings
:
{},
providerSettings
:
{},
telemetryConsent
:
"unset"
,
telemetryConsent
:
"unset"
,
telemetryUserId
:
uuidv4
(),
telemetryUserId
:
uuidv4
(),
hasRunBefore
:
false
,
};
};
const
SETTINGS_FILE
=
"user-settings.json"
;
const
SETTINGS_FILE
=
"user-settings.json"
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论