Skip to content

Commit

Permalink
🐛 fixed #8
Browse files Browse the repository at this point in the history
  • Loading branch information
yann0917 committed May 7, 2023
1 parent 374be9a commit 94a69cc
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 41 deletions.
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,11 @@
* 每天听本书可下载音频,文稿生成 Markdown 文档
* 电子书可下载 pdf,html, epub 等格式

注:
### 注:

1. 下载均在后台执行,下载完毕弹框会关闭,等待弹窗关闭或者点击确定下载后关闭,均会在后台执行下载程序。
2. 如果遇到 `496 NoCertificate` 消息提示,请登录网页版进行图形验证码验证。

### 功能截图如下:

![](image/Snipaste_2023-04-16_21-11-23.png)
![](image/Snipaste_2023-04-17_00-01-03.png)
![](image/Snipaste_2023-04-16_21-09-18.png)
![](image/Snipaste_2023-02-21_19-13-26.png)
![](image/Snipaste_2023-02-21_19-14-14.png)
![](image/Snipaste_2023-02-21_19-14-27.png)
![](image/Snipaste_2023-02-21_19-15-12.png)
![](image/Snipaste_2023-02-21_19-15-44.png)
![](image/Snipaste_2023-02-21_19-25-03.png)
3. 本应用上登录后再登录官方网页版会导致保存的 cookie 失效,使用 `rm -rf ~/.config/dedao/config.json` 删除配置信息后重新登陆本应用即可。

## 安装

Expand Down Expand Up @@ -77,6 +66,17 @@ wails 构建需要安装以下依赖:
* ffmpeg
> 音频需要借助 [ffmpeg](https://ffmpeg.org/) 合成
### 功能截图如下:

![](image/Snipaste_2023-04-16_21-11-23.png)
![](image/Snipaste_2023-04-17_00-01-03.png)
![](image/Snipaste_2023-04-16_21-09-18.png)
![](image/Snipaste_2023-02-21_19-13-26.png)
![](image/Snipaste_2023-02-21_19-14-14.png)
![](image/Snipaste_2023-02-21_19-14-27.png)
![](image/Snipaste_2023-02-21_19-15-12.png)
![](image/Snipaste_2023-02-21_19-15-44.png)
![](image/Snipaste_2023-02-21_19-25-03.png)

## Stargazers over time

Expand All @@ -86,5 +86,4 @@ wails 构建需要安装以下依赖:

[MIT](./LICENSE) © yann0917


---
2 changes: 1 addition & 1 deletion backend/app/download.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package app

import (
"errors"
"os"
"path/filepath"
"sort"
"strconv"
"strings"

jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/yann0917/dedao-gui/backend/downloader"
"github.com/yann0917/dedao-gui/backend/services"
"github.com/yann0917/dedao-gui/backend/utils"
Expand Down
2 changes: 1 addition & 1 deletion backend/app/login.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package app

import (
"errors"
"fmt"
"strings"

"github.com/pkg/errors"
"github.com/yann0917/dedao-gui/backend/config"
"github.com/yann0917/dedao-gui/backend/services"
)
Expand Down
2 changes: 1 addition & 1 deletion backend/config/config.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package config

import (
"errors"
"io"
"log"
"os"
"path/filepath"
"sync"

jsoniter "github.com/json-iterator/go"
"github.com/pkg/errors"
"github.com/yann0917/dedao-gui/backend/services"
)

Expand Down
3 changes: 1 addition & 2 deletions backend/services/course.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package services

import (
"errors"
"math"

"github.com/pkg/errors"
)

// Course metadata
Expand Down
10 changes: 0 additions & 10 deletions backend/services/login.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package services

import (
"github.com/pkg/errors"
)

type QrCodeResp struct {
ErrCode int `json:"errCode"`
ErrMsg string `json:"errMsg"`
Expand All @@ -25,29 +21,23 @@ type CheckLoginResp struct {
func (s *Service) LoginAccessToken() (token string, err error) {
token, err = s.reqGetLoginAccessToken(CsrfToken)
if err != nil {
err = errors.Wrap(err, "request login err")
return
}

return
}

func (s *Service) GetQrcode(token string) (resp *QrCodeResp, err error) {
resp, err = s.reqGetQrcode(token)
if err != nil {
err = errors.Wrap(err, "request login err")
return
}

return
}

func (s *Service) CheckLogin(token, qrcode string) (check *CheckLoginResp, cookie string, err error) {
check, cookie, err = s.reqCheckLogin(token, qrcode)
if err != nil {
err = errors.Wrap(err, "request login err")
return
}

return
}
6 changes: 0 additions & 6 deletions backend/services/user.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
package services

import (
"github.com/pkg/errors"
)

// User user info
type User struct {
Nickname string `json:"nickname"`
Expand Down Expand Up @@ -97,7 +93,6 @@ type OdobUser struct {
func (s *Service) User() (user *User, err error) {
body, err := s.reqUser()
if err != nil {
err = errors.Wrap(err, "request user err")
return
}
defer body.Close()
Expand Down Expand Up @@ -142,7 +137,6 @@ type Token struct {
func (s *Service) Token() (t *Token, err error) {
body, err := s.reqToken()
if err != nil {
err = errors.Wrap(err, "request token err")
return
}
defer body.Close()
Expand Down
1 change: 1 addition & 0 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ declare module '@vue/runtime-core' {
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElProgress: typeof import('element-plus/es')['ElProgress']
ElRate: typeof import('element-plus/es')['ElRate']
ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
Expand Down
15 changes: 14 additions & 1 deletion frontend/src/components/DownloadDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
<el-option v-for="item in props.downloadTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-progress v-show="percentage"
:percentage="percentage"
status="success"
:indeterminate="true"
:duration="3"
><span>{{content}}</span></el-progress>
</el-form>

<template #footer>
Expand All @@ -22,9 +28,12 @@

<script lang="ts" setup>
import {onMounted, ref} from "vue";
import {EbookDownload,CourseDownload} from "../../wailsjs/go/backend/App";
import {EbookDownload, CourseDownload} from "../../wailsjs/go/backend/App";
import {ElMessage} from "element-plus";
let percentage=ref(0)
let content=ref('')
const dialogVisible = ref(false)
const downloadType = ref(1)
// const downloadId = ref(0)
Expand Down Expand Up @@ -77,10 +86,14 @@ const closeDialog = () => {
// initForm()
// downloadType.value = 1
// dialogVisible.value = false
percentage.value = 0
content.value = ''
emits("close")
}
const download = async () => {
percentage.value = 66
content.value = '下载中'
switch (props.prodType) {
case 2:
await EbookDownload(props.downloadId, downloadType.value, props.enId).then((info) => {
Expand Down
24 changes: 20 additions & 4 deletions frontend/src/views/Odob.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,19 @@
</el-dialog>

<el-dialog v-model="dialogDownloadVisible" title="请选择下载格式" align-center center width="30%">
<el-select v-model="downloadType" placeholder="请选择下载格式">
<el-option v-for="item in downloadTypeOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
<el-form >
<el-form-item label="下载格式" label-width="80px">
<el-select v-model="downloadType" placeholder="请选择下载格式">
<el-option v-for="item in downloadTypeOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-progress v-show="percentage"
:percentage="percentage"
status="success"
:indeterminate="true"
:duration="3"
><span>{{content}}</span></el-progress>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="closeDownloadDialog">取消</el-button>
Expand All @@ -92,7 +102,6 @@

</el-dialog>


<el-drawer direction="btt" :title="media?.title" v-model="videoVisible" size="30%" @close="closeVideo" @open="open"
@opened="openVideo(media)">
<div style="position:relative;" v-html="videohtml"></div>
Expand Down Expand Up @@ -140,6 +149,9 @@ const downloadTypeOptions = [
{value: 1, label: "MP3"}, {value: 2, label: "PDF"}, {value: 3, label: "Markdown"}
]
let percentage=ref(0)
let content=ref('')
const closeVideo = () => {
// if (videoPlayer.value) {
// videoPlayer.value.dispose();
Expand Down Expand Up @@ -289,9 +301,13 @@ const openDownloadDialog = (row: any) => {
const closeDownloadDialog = () => {
downloadType.value = 1
dialogDownloadVisible.value = false
percentage.value = 0
content.value = ''
}
const download = async (id: number, dType: number) => {
percentage.value = 66
content.value = '下载中'
await OdobDownload(id, dType, downloadData).then((info) => {
console.log(info)
}).catch((error) => {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ require (
github.com/json-iterator/go v1.1.12
github.com/mattn/go-colorable v0.1.13
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/errors v0.9.1
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
github.com/wailsapp/wails/v2 v2.4.1
golang.org/x/sync v0.1.0
Expand Down Expand Up @@ -42,6 +41,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
Expand Down

0 comments on commit 94a69cc

Please sign in to comment.