Skip to content

Commit

Permalink
✨ feat: sideload extension loaded by chibi only
Browse files Browse the repository at this point in the history
Signed-off-by: SimonShiki <sinangentoo@gmail.com>
  • Loading branch information
SimonShiki committed Nov 9, 2023
1 parent 2f5540a commit 3dd9875
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"app.settings.extension.noConfirmDialog": "No Confirmation Dialog While Loading Project",
"app.settings.project": "Project",
"app.settings.project.convertProcCall": "Convert Sideload Extension's Blocks Into Procedures Call",
"app.settings.project.sideloadOnly": "Only load extension loaded by Chibi",
"app.title.gallary": "Extension Gallary",
"app.title.manage": "Manage Extension",
"app.title.settings": "Settings"
Expand Down
1 change: 1 addition & 0 deletions locales/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"app.settings.extension.noConfirmDialog": "不确认加载带侧载扩展的项目",
"app.settings.project": "项目",
"app.settings.project.convertProcCall": "将侧载扩展积木转换为自定义积木",
"app.settings.project.sideloadOnly": "仅加载通过 Chibi 加载的扩展",
"app.title.gallary": "扩展橱窗",
"app.title.manage": "扩展管理",
"app.title.settings": "设置"
Expand Down
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface SettingsInfo {
convertProcCall: boolean;
dontExposeCtx: boolean;
noConfirmDialog: boolean;
sideloadOnly: boolean;
}

export interface ClientInfo {
Expand Down
31 changes: 31 additions & 0 deletions src/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,37 @@ function Settings (props: SettingsProps) {
disabled={!props.clientInfo() || props.clientInfo()!.version < 5}
/>
</Box>
<Box sx={{
display: 'flex',
alignItems: 'center'
}}>
<Typography>
{intl.formatMessage({
id: 'app.settings.project.sideloadOnly',
defaultMessage: 'Only load extension loaded by Chibi'
})}
<Show when={!props.clientInfo() || props.clientInfo()!.version < 6}>
<Typography
color='text.secondary'
sx={{fontSize: '12px'}}
>{`Required Chibi >= 6`}</Typography>
</Show>
</Typography>
<Switch
sx={{marginLeft: 'auto'}}
checked={props.settings()?.sideloadOnly}
onChange={(_, value) => {
window.opener.postMessage({
type: 'updateSettings',
item: {
name: 'sideloadOnly',
value: value
}
}, '*');
}}
disabled={!props.clientInfo() || props.clientInfo()!.version < 6}
/>
</Box>
</Stack>
</Box>
</Card>
Expand Down

0 comments on commit 3dd9875

Please sign in to comment.