feat: add the option to copy the URL

This commit is contained in:
mio 2023-05-17 23:34:44 +08:00
parent a2dcda6be0
commit 82f42e56db
7 changed files with 34 additions and 3 deletions

@ -1,6 +1,6 @@
{
"name": "star-rail-warp-export",
"version": "0.0.16",
"version": "0.0.17",
"main": "./dist/electron/main/main.js",
"author": "biuuu <https://github.com/biuuu>",
"license": "MIT",

@ -10,6 +10,7 @@
"ui.button.startProxy": "Proxy mode",
"ui.button.solution": "Solution",
"ui.button.cacheFolder": "Open cache folder",
"ui.button.copyUrl": "Copy URL",
"ui.select.newAccount": "New account",
"ui.hint.newAccount": "Export data from other accounts",
"ui.hint.init": "Please open your warp history inside the game client before clicking on the 'Load data' button",
@ -84,5 +85,6 @@
"excel.filePrefix": "Star Rail Warp logger",
"excel.fileType": "Excel file",
"ui.extra.cacheClean": "1. Confirm whether the warp history in the game has been opened, and if the error \"User authentication expired\" still appears, try the following steps \n2. Close the game window of Star Rail \n3. Click the \"Open Web Cache Folder\" button above to open the \"Cache\" folder \n4. Delete the \"Cache_ Data\" folder \n5. Start the Star Rail game and open the warp history page in the game \n6. Close this dialog and click the \"Update Data\" button",
"ui.extra.findCacheFolder": "If the \"Open cache folder\" button does not respond, you can manually find the game's web cache folder. The directory is \"Your game installation path/Star Rail/Games/StarRail_Data/webCaches/Cache/\""
"ui.extra.findCacheFolder": "If the \"Open cache folder\" button does not respond, you can manually find the game's web cache folder. The directory is \"Your game installation path/Star Rail/Games/StarRail_Data/webCaches/Cache/\"",
"ui.extra.urlCopied": "URL Copied"
}

@ -10,6 +10,7 @@
"ui.button.startProxy": "代理模式",
"ui.button.solution": "解决办法",
"ui.button.cacheFolder": "打开网页缓存文件夹",
"ui.button.copyUrl": "复制URL",
"ui.select.newAccount": "新账号",
"ui.hint.newAccount": "从其它账号导出数据",
"ui.hint.init": "请先在游戏里打开任意一个抽卡记录后再点击“加载数据”按钮",
@ -84,5 +85,6 @@
"excel.filePrefix": "星穹铁道跃迁记录",
"excel.fileType": "Excel文件",
"ui.extra.cacheClean": "1. 确认是否已经打开游戏内的抽卡历史记录,如果仍然出现“身份认证已过期”的错误,再尝试下面的步骤\n2. 关闭星穹铁道的游戏窗口\n3. 点击上方的“打开缓存文件夹”按钮打开Cache文件夹\n4. 删除Cache_Data文件夹\n5. 启动星穹铁道游戏,打开游戏内抽卡历史记录页面\n6. 关闭这个对话框,再点击“更新数据”按钮",
"ui.extra.findCacheFolder": "如果点“打开缓存文件夹”按钮没有反应,可以手动找到游戏的网页缓存文件夹,目录为“你的游戏安装路径/Star Rail/Game/StarRail_Data/webCaches/Cache/”"
"ui.extra.findCacheFolder": "如果点“打开缓存文件夹”按钮没有反应,可以手动找到游戏的网页缓存文件夹,目录为“你的游戏安装路径/Star Rail/Game/StarRail_Data/webCaches/Cache/”",
"ui.extra.urlCopied": "URL已复制"
}

11
src/main/bridge.js Normal file

@ -0,0 +1,11 @@
const { clipboard, ipcMain } = require('electron')
const { getUrl } = require('./getData')
ipcMain.handle('COPY_URL', async () => {
const url = await getUrl()
if (url) {
clipboard.writeText(url)
return true
}
return false
})

@ -508,3 +508,5 @@ exports.getData = () => {
current: config.current
}
}
exports.getUrl = getUrl

@ -2,6 +2,7 @@ const { app, BrowserWindow, ipcMain } = require('electron')
const { initWindow } = require('./utils')
const { disableProxy, proxyStatus } = require('./module/system-proxy')
require('./getData')
require('./bridge')
require('./excel')
require('./UIGFJson')
const { getUpdateInfo } = require('./update/index')

@ -26,6 +26,7 @@
<el-dropdown-menu>
<el-dropdown-item command="setting" icon="setting">{{ui.button.setting}}</el-dropdown-item>
<el-dropdown-item :disabled="!allowClick() || state.status === 'loading'" command="url" icon="link">{{ui.button.url}}</el-dropdown-item>
<el-dropdown-item command="copyUrl" icon="DocumentCopy">{{ui.button.copyUrl}}</el-dropdown-item>
<el-dropdown-item :disabled="!allowClick() || state.status === 'loading'" command="proxy" icon="position">{{ui.button.startProxy}}</el-dropdown-item>
</el-dropdown-menu>
</template>
@ -80,6 +81,7 @@ import Setting from './components/Setting.vue'
import gachaDetail from './gachaDetail'
import { version } from '../../package.json'
import gachaType from '../gachaType.json'
import { ElMessage } from 'element-plus'
const state = reactive({
status: 'init',
@ -249,6 +251,8 @@ const optionCommand = (type) => {
state.showUrlDlg = true
} else if (type === 'proxy') {
fetchData('proxy')
} else if (type === 'copyUrl') {
copyUrl()
}
}
@ -260,6 +264,15 @@ const updateConfig = async () => {
state.config = await ipcRenderer.invoke('GET_CONFIG')
}
const copyUrl = async () => {
const successed = await ipcRenderer.invoke('COPY_URL')
if (successed) {
ElMessage.success(ui.value.extra.urlCopied)
} else {
ElMessage.error(state.i18n.log.url.notFound)
}
}
onMounted(async () => {
await readData()
await getI18nData()