Compare commits

..

No commits in common. "581a1b79ca631305f0f2b03f4228eb0578e15be9" and "f3a43c808330d0a0118ddbc9f10775fe3445052f" have entirely different histories.

13 changed files with 22 additions and 150 deletions

View File

@ -15,7 +15,6 @@ import (
"net"
"os"
"path"
"strconv"
"strings"
"sync"
"time"
@ -513,36 +512,3 @@ func (c *connectionService) ImportConnections() (resp types.JSResp) {
resp.Success = true
return
}
// ParseConnectURL parse connection url string
func (c *connectionService) ParseConnectURL(url string) (resp types.JSResp) {
urlOpt, err := redis.ParseURL(url)
if err != nil {
resp.Msg = err.Error()
return
}
addrPart := strings.Split(urlOpt.Addr, ":")
addr := addrPart[0]
port := 6379
if len(addrPart) > 1 {
port, _ = strconv.Atoi(addrPart[1])
}
resp.Success = true
resp.Data = struct {
Addr string `json:"addr"`
Port int `json:"port"`
Username string `json:"username"`
Password string `json:"password"`
ConnTimeout int64 `json:"connTimeout"`
ExecTimeout int64 `json:"execTimeout"`
}{
Addr: addr,
Port: port,
Username: urlOpt.Username,
Password: urlOpt.Password,
ConnTimeout: int64(urlOpt.DialTimeout.Seconds()),
ExecTimeout: int64(urlOpt.ReadTimeout.Seconds()),
}
return
}

View File

@ -3,7 +3,6 @@ package services
import (
"context"
"github.com/wailsapp/wails/v2/pkg/runtime"
runtime2 "runtime"
"sync"
"time"
"tinyrdm/backend/consts"
@ -12,8 +11,7 @@ import (
)
type systemService struct {
ctx context.Context
appVersion string
ctx context.Context
}
var system *systemService
@ -22,18 +20,15 @@ var onceSystem sync.Once
func System() *systemService {
if system == nil {
onceSystem.Do(func() {
system = &systemService{
appVersion: "0.0.0",
}
system = &systemService{}
go system.loopWindowEvent()
})
}
return system
}
func (s *systemService) Start(ctx context.Context, version string) {
func (s *systemService) Start(ctx context.Context) {
s.ctx = ctx
s.appVersion = version
// maximize the window if screen size is lower than the minimum window size
if screen, err := runtime.ScreenGetAll(ctx); err == nil && len(screen) > 0 {
@ -48,20 +43,6 @@ func (s *systemService) Start(ctx context.Context, version string) {
}
}
func (s *systemService) Info() (resp types.JSResp) {
resp.Success = true
resp.Data = struct {
OS string `json:"os"`
Arch string `json:"arch"`
Version string `json:"version"`
}{
OS: runtime2.GOOS,
Arch: runtime2.GOARCH,
Version: s.appVersion,
}
return
}
// SelectFile open file dialog to select a file
func (s *systemService) SelectFile(title string, extensions []string) (resp types.JSResp) {
filters := sliceutil.Map(extensions, func(i int) runtime.FileFilter {

View File

@ -1,16 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<html lang='en'>
<head>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta charset='UTF-8' />
<meta content='width=device-width, initial-scale=1.0' name='viewport' />
<title>Tiny RDM</title>
<!-- <link href="./src/styles/style.scss" rel="stylesheet">-->
</head>
<body spellcheck="false">
<div id="app"></div>
<script async data-website-id="ad6de51d-1e27-44a5-958d-319679c56aec"
src="https://analytics.tinycraft.cc/script.js"></script>
<script src="./src/main.js" type="module"></script>
<div id='app'></div>
<script src='./src/main.js' type='module'></script>
</body>
</html>

View File

@ -24,7 +24,7 @@
"@vitejs/plugin-vue": "^5.0.3",
"naive-ui": "^2.37.3",
"prettier": "^3.2.4",
"unplugin-auto-import": "^0.17.4",
"unplugin-auto-import": "^0.17.3",
"unplugin-icons": "^0.18.2",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.12"
@ -2067,9 +2067,9 @@
}
},
"node_modules/unplugin-auto-import": {
"version": "0.17.4",
"resolved": "https://registry.npmjs.org/unplugin-auto-import/-/unplugin-auto-import-0.17.4.tgz",
"integrity": "sha512-sInr7+UOeFMtiRCr7lYZXouTnVqXNUJtN5yN5GDzg6Sr2rwY5ZWZmqf4yvItYCm8mq1PdzPw3oojYHgZAJnTRQ==",
"version": "0.17.3",
"resolved": "https://registry.npmjs.org/unplugin-auto-import/-/unplugin-auto-import-0.17.3.tgz",
"integrity": "sha512-0cn0wr8X579TtdZKUAps0dDVrYzttx38ImdxZjmCeNlMDJX8UuSjO83vFqgS4ClNDIGWAute+xl9j5vRSX+vsw==",
"dev": true,
"dependencies": {
"@antfu/utils": "^0.7.7",
@ -2078,7 +2078,7 @@
"local-pkg": "^0.5.0",
"magic-string": "^0.30.5",
"minimatch": "^9.0.3",
"unimport": "^3.7.1",
"unimport": "^3.7.0",
"unplugin": "^1.6.0"
},
"engines": {
@ -3821,9 +3821,9 @@
}
},
"unplugin-auto-import": {
"version": "0.17.4",
"resolved": "https://registry.npmjs.org/unplugin-auto-import/-/unplugin-auto-import-0.17.4.tgz",
"integrity": "sha512-sInr7+UOeFMtiRCr7lYZXouTnVqXNUJtN5yN5GDzg6Sr2rwY5ZWZmqf4yvItYCm8mq1PdzPw3oojYHgZAJnTRQ==",
"version": "0.17.3",
"resolved": "https://registry.npmjs.org/unplugin-auto-import/-/unplugin-auto-import-0.17.3.tgz",
"integrity": "sha512-0cn0wr8X579TtdZKUAps0dDVrYzttx38ImdxZjmCeNlMDJX8UuSjO83vFqgS4ClNDIGWAute+xl9j5vRSX+vsw==",
"dev": true,
"requires": {
"@antfu/utils": "^0.7.7",
@ -3832,7 +3832,7 @@
"local-pkg": "^0.5.0",
"magic-string": "^0.30.5",
"minimatch": "^9.0.3",
"unimport": "^3.7.1",
"unimport": "^3.7.0",
"unplugin": "^1.6.0"
},
"dependencies": {

View File

@ -25,7 +25,7 @@
"@vitejs/plugin-vue": "^5.0.3",
"naive-ui": "^2.37.3",
"prettier": "^3.2.4",
"unplugin-auto-import": "^0.17.4",
"unplugin-auto-import": "^0.17.3",
"unplugin-icons": "^0.18.2",
"unplugin-vue-components": "^0.26.0",
"vite": "^5.0.12"

View File

@ -1 +1 @@
91df99a27ba619287c70d3f15e70a9ac
6403086a3d7567446771161c9ad44994

View File

@ -20,7 +20,6 @@ import AboutDialog from '@/components/dialogs/AboutDialog.vue'
import FlushDbDialog from '@/components/dialogs/FlushDbDialog.vue'
import ExportKeyDialog from '@/components/dialogs/ExportKeyDialog.vue'
import ImportKeyDialog from '@/components/dialogs/ImportKeyDialog.vue'
import { Info } from 'wailsjs/go/services/systemService.js'
const prefStore = usePreferencesStore()
const connectionStore = useConnectionStore()
@ -34,10 +33,6 @@ onMounted(async () => {
if (prefStore.autoCheckUpdate) {
prefStore.checkForUpdate()
}
Info().then(({ data }) => {
// const {os, arch, version} = data
umami && umami.track('startup', data)
})
} finally {
initializing.value = false
}

View File

@ -267,29 +267,6 @@ const onTestConnection = async () => {
const onClose = () => {
dialogStore.closeConnDialog()
}
const pasteFromClipboard = async () => {
// url example:
// redis://user:password@localhost:6789/3?dial_timeout=3&db=1&read_timeout=6s&max_retries=2
let opt = {}
try {
opt = await connectionStore.parseUrlFromClipboard()
} catch (e) {
$message.error(i18n.t('dialogue.connection.parse_fail', { reason: e.message }))
return
}
generalForm.value.name = generalForm.value.addr = opt.addr
generalForm.value.port = opt.port
generalForm.value.username = opt.username
generalForm.value.password = opt.password
if (opt.connTimeout > 0) {
generalForm.value.connTimeout = opt.connTimeout
}
if (opt.execTimeout > 0) {
generalForm.value.execTimeout = opt.execTimeout
}
$message.success(i18n.t('dialogue.connection.parse_pass', { url: opt.url }))
}
</script>
<template>
@ -708,9 +685,6 @@ const pasteFromClipboard = async () => {
</n-button>
</div>
<div class="flex-item n-dialog__action">
<n-button :disabled="closingConnection" :focusable="false" @click="pasteFromClipboard">
{{ $t('dialogue.connection.parse_url_clipboard') }}
</n-button>
<n-button :disabled="closingConnection" :focusable="false" @click="onClose">
{{ $t('common.cancel') }}
</n-button>

View File

@ -109,18 +109,11 @@ const onSelectPreferenceMenu = (key) => {
}
}
const openWechatOfficial = () => {
umami && umami.track('open', { target: 'wechat_official' })
showWechat.value = true
}
const openX = () => {
umami && umami.track('open', { target: 'x' })
BrowserOpenURL('https://twitter.com/LykinHuang')
}
const openGithub = () => {
umami && umami.track('open', { target: 'github' })
BrowserOpenURL('https://github.com/tiny-craft/tiny-rdm')
}
@ -170,7 +163,7 @@ const exThemeVars = computed(() => {
:size="iconSize"
class="nav-menu-button"
t-tooltip="ribbon.wechat_official"
@click="openWechatOfficial" />
@click="showWechat = true" />
<icon-button
v-else
:border="false"

View File

@ -187,9 +187,6 @@
"test": "Test Connection",
"test_succ": "Successful connection to redis-server",
"test_fail": "Fail Connection",
"parse_url_clipboard": "Parse URL from Clipboard",
"parse_pass": "Redis URL Parsed {url}",
"parse_fail": "Parse Redis URL failed: {reason}",
"advn": {
"title": "Advanced",
"filter": "Default Key Filter Pattern",

View File

@ -187,9 +187,6 @@
"test": "测试连接",
"test_succ": "成功连接到Redis服务器",
"test_fail": "连接失败",
"parse_url_clipboard": "解析剪切板中的URL",
"parse_pass": "解析Redis URL完成: {url}",
"parse_fail": "解析Redis URL失败: {reason}",
"advn": {
"title": "高级配置",
"filter": "默认键过滤表达式",

View File

@ -1,5 +1,5 @@
import { defineStore } from 'pinia'
import { get, isEmpty, isObject, uniq } from 'lodash'
import { get, isEmpty, uniq } from 'lodash'
import {
CreateGroup,
DeleteConnection,
@ -8,7 +8,6 @@ import {
GetConnection,
ImportConnections,
ListConnection,
ParseConnectURL,
RenameGroup,
SaveConnection,
SaveLastDB,
@ -19,7 +18,6 @@ import { ConnectionType } from '@/consts/connection_type.js'
import { KeyViewType } from '@/consts/key_view_type.js'
import useBrowserStore from 'stores/browser.js'
import { i18nGlobal } from '@/utils/i18n.js'
import { ClipboardGetText } from 'wailsjs/runtime/runtime.js'
const useConnectionStore = defineStore('connections', {
/**
@ -406,10 +404,6 @@ const useConnectionStore = defineStore('connections', {
return { success: true }
},
/**
* export connections to zip
* @return {Promise<void>}
*/
async exportConnections() {
const {
success,
@ -426,10 +420,6 @@ const useConnectionStore = defineStore('connections', {
$message.success(i18nGlobal.t('dialogue.handle_succ'))
},
/**
* import connections from zip
* @return {Promise<void>}
*/
async importConnections() {
const { success, msg } = await ImportConnections()
if (!success) {
@ -441,25 +431,6 @@ const useConnectionStore = defineStore('connections', {
$message.success(i18nGlobal.t('dialogue.handle_succ'))
},
/**
* parse redis url from text in clipboard
* @return {Promise<{}>}
*/
async parseUrlFromClipboard() {
const urlString = await ClipboardGetText()
if (isEmpty(urlString)) {
throw new Error('no text in clipboard')
}
const { success, msg, data } = await ParseConnectURL(urlString)
if (!success || !isObject(data)) {
throw new Error(msg || 'unknown')
}
data.url = urlString
return data
},
},
})

View File

@ -66,7 +66,7 @@ func main() {
BackgroundColour: options.NewRGBA(27, 38, 54, 0),
StartHidden: true,
OnStartup: func(ctx context.Context) {
sysSvc.Start(ctx, version)
sysSvc.Start(ctx)
connSvc.Start(ctx)
browserSvc.Start(ctx)
cliSvc.Start(ctx)