Display thirdparty licenses

This commit is contained in:
AkiraFukushima 2023-05-11 00:31:51 +09:00
parent 350246bf76
commit 6722b69cbf
No known key found for this signature in database
GPG Key ID: 4D6EFFAFF7F7FF8D
5 changed files with 130 additions and 18 deletions

View File

@ -34,7 +34,8 @@
"jump_to": "Jump to" "jump_to": "Jump to"
}, },
"help": { "help": {
"name": "Help" "name": "Help",
"thirdparty": "Thirdparty licenses"
} }
}, },
"global_header": { "global_header": {
@ -303,6 +304,9 @@
"comment": "Additional comments", "comment": "Additional comments",
"cancel": "Cancel", "cancel": "Cancel",
"ok": "Report" "ok": "Report"
},
"thirdparty": {
"title": "Thirdparty licenses"
} }
}, },
"cards": { "cards": {

View File

@ -790,22 +790,16 @@ ipcMain.handle('list-fonts', async (_: IpcMainInvokeEvent) => {
}) })
// Settings // Settings
ipcMain.handle( ipcMain.handle('get-account-setting', async (_: IpcMainInvokeEvent, accountId: number): Promise<Setting> => {
'get-account-setting',
async (_: IpcMainInvokeEvent, accountId: number): Promise<Setting> => {
const setting = await getSetting(db, accountId) const setting = await getSetting(db, accountId)
return setting return setting
} })
)
ipcMain.handle( ipcMain.handle('update-account-setting', async (_: IpcMainInvokeEvent, setting: Setting): Promise<Setting> => {
'update-account-setting',
async (_: IpcMainInvokeEvent, setting: Setting): Promise<Setting> => {
console.log(setting) console.log(setting)
const res = await createOrUpdateSetting(db, setting) const res = await createOrUpdateSetting(db, setting)
return res return res
} })
)
// Cache // Cache
ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => { ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {
@ -1047,6 +1041,12 @@ const ApplicationMenu = (accountsChange: Array<MenuItemConstructorOptions>, menu
click: () => { click: () => {
mainWindow!.webContents.send('open-shortcuts-list') mainWindow!.webContents.send('open-shortcuts-list')
} }
},
{
label: i18n.t<string>('main_menu.help.thirdparty'),
click: () => {
mainWindow!.webContents.send('open-thirdparty-modal')
}
} }
] ]
} }

View File

@ -7,6 +7,7 @@
<mute-confirm v-if="muteConfirmModal"></mute-confirm> <mute-confirm v-if="muteConfirmModal"></mute-confirm>
<shortcut></shortcut> <shortcut></shortcut>
<report v-if="reportModal"></report> <report v-if="reportModal"></report>
<thirdparty />
</div> </div>
</template> </template>
@ -20,6 +21,7 @@ import AddListMember from './Modals/AddListMember.vue'
import MuteConfirm from './Modals/MuteConfirm.vue' import MuteConfirm from './Modals/MuteConfirm.vue'
import Shortcut from './Modals/Shortcut.vue' import Shortcut from './Modals/Shortcut.vue'
import Report from './Modals/Report.vue' import Report from './Modals/Report.vue'
import Thirdparty from './Modals/Thirdparty.vue'
export default defineComponent({ export default defineComponent({
name: 'modals', name: 'modals',
@ -30,7 +32,8 @@ export default defineComponent({
AddListMember, AddListMember,
MuteConfirm, MuteConfirm,
Shortcut, Shortcut,
Report Report,
Thirdparty
}, },
setup() { setup() {
const store = useStore() const store = useStore()

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="shortcut"> <div class="shortcut">
<el-dialog :title="$t('modals.shortcut.title')" v-model="shortcutModal" width="500px" custom-class="shortcut-modal"> <el-dialog :title="$t('modals.shortcut.title')" v-model="shortcutModal" width="500px">
<table class="shortcuts"> <table class="shortcuts">
<tbody> <tbody>
<tr> <tr>

View File

@ -0,0 +1,105 @@
<template>
<div class="thirdparty">
<el-dialog :title="$t('modals.thirdparty.title')" v-model="modalOpen" width="500px" class="thirdparty-modal">
<table class="licenses">
<tbody>
<template v-for="lib in thirdparty">
<tr>
<td>{{ lib.package_name }}</td>
<td>{{ lib.license }}</td>
</tr>
</template>
</tbody>
</table>
</el-dialog>
</div>
</template>
<script lang="ts">
import { defineComponent, onMounted, ref } from 'vue'
import { MyWindow } from '~/src/types/global'
import thirdparty from '~/src/config/thirdparty.json'
export default defineComponent({
name: 'thirdparty',
setup() {
const win = window as any as MyWindow
const modalOpen = ref(false)
onMounted(() => {
win.ipcRenderer.on('open-thirdparty-modal', () => {
modalOpen.value = true
})
})
return {
modalOpen,
thirdparty
}
}
})
</script>
<style lang="scss" scoped>
.thirdparty :deep() {
.el-dialog__header {
background-color: #4a5664;
margin-right: 0;
.el-dialog__title {
color: #ebeef5;
}
}
.el-dialog__body {
max-height: 400px;
box-sizing: border-box;
overflow: auto;
}
.thirdparty-modal {
max-height: 70%;
overflow: hidden;
position: relative;
}
}
.thirdparty {
.licenses {
text-align: left;
border-collapse: collapse;
line-height: 28px;
width: 100%;
tr {
border: none;
&:nth-child(even) {
background-color: #fafafa;
}
&:hover {
background-color: #f2f6fc;
}
td {
padding: 4px 8px;
}
}
kbd {
display: inline-block;
padding: 3px 5px;
font-size: 11px;
line-height: 10px;
color: #444d56;
vertical-align: middle;
background-color: #fafbfc;
border: solid 1px #c6cbd1;
border-bottom-color: #959da5;
border-radius: 3px;
box-shadow: inset 0 -1px 0 #959da5;
}
}
}
</style>