Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
troyeguo committed Sep 2, 2023
1 parent fc7c6f4 commit c5c5657
Show file tree
Hide file tree
Showing 35 changed files with 733 additions and 131 deletions.
11 changes: 10 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const fs = require("fs");
const configDir = app.getPath("userData");
const { ra } = require("./edge-tts");
const dirPath = path.join(configDir, "uploads");
const { Blob } = require("buffer");
let mainWin;
const singleInstance = app.requestSingleInstanceLock();
var filePath = null;
Expand Down Expand Up @@ -156,6 +155,16 @@ const createMainWin = () => {
});
return path;
});
ipcMain.handle("get-url-content", async (event, config) => {
const axios = require("axios");
try {
const response = await axios.get(config.url);
return response.data;
} catch (error) {
console.error(error);
return null;
}
});
ipcMain.on("storage-location", (event, arg) => {
event.returnValue = path.join(dirPath, "data");
});
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"react-error-overlay": "6.0.9"
},
"dependencies": {
"@types/ws": "^8.5.5",
"@vitalets/google-translate-api": "^8.0.0",
"adm-zip": "^0.5.2",
"axios": "^0.19.2",
Expand All @@ -34,6 +35,7 @@
"request": "^2.88.2",
"webdav": "^3.6.2",
"webdav-fs": "^3.0.0",
"ws": "^8.13.0",
"zip-a-folder": "^0.0.12"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion public/assets/styles/blue.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.google-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
5 changes: 3 additions & 2 deletions public/assets/styles/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ body,
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.google-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand All @@ -114,7 +115,7 @@ body,
.book-manage-title:hover,
.backup-page-list-item:hover,
.restore-file:hover,
Z .copy-option:hover {
.copy-option:hover {
background-color: rgba(235, 235, 235, 0.035);
}
.drag-background {
Expand Down
3 changes: 2 additions & 1 deletion public/assets/styles/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ body,
.speaker-option:hover,
.backup-page-backup:hover,
.search-book-option:hover,
.google-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
3 changes: 2 additions & 1 deletion public/assets/styles/green.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.google-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
3 changes: 2 additions & 1 deletion public/assets/styles/purple.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.google-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
3 changes: 2 additions & 1 deletion public/assets/styles/red.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
.translation-option:hover,
.speaker-option:hover,
.search-book-option:hover,
.google-option:hover,
.dict-option:hover,
.browser-option:hover,
.header-search-text:hover,
.reader-setting-icon-container:hover,
.setting-icon-container:hover,
Expand Down
Binary file modified src/assets/styles/fonts/icomoon.eot
Binary file not shown.
3 changes: 3 additions & 0 deletions src/assets/styles/fonts/icomoon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/styles/fonts/icomoon.ttf
Binary file not shown.
Binary file modified src/assets/styles/fonts/icomoon.woff
Binary file not shown.
19 changes: 14 additions & 5 deletions src/assets/styles/style.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?43s8j0');
src: url('fonts/icomoon.eot?43s8j0#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?43s8j0') format('truetype'),
url('fonts/icomoon.woff?43s8j0') format('woff'),
url('fonts/icomoon.svg?43s8j0#icomoon') format('svg');
src: url('fonts/icomoon.eot?i48bgd');
src: url('fonts/icomoon.eot?i48bgd#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?i48bgd') format('truetype'),
url('fonts/icomoon.woff?i48bgd') format('woff'),
url('fonts/icomoon.svg?i48bgd#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
Expand All @@ -25,6 +25,15 @@
-moz-osx-font-smoothing: grayscale;
}

.icon-browser:before {
content: "\e950";
}
.icon-internet:before {
content: "\e94f";
}
.icon-dict:before {
content: "\e94e";
}
.icon-bookshelf-line:before {
content: "\e94b";
}
Expand Down
17 changes: 12 additions & 5 deletions src/components/bookCoverItem/bookCoverItem.css
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
height: 18px;
font-size: 13px;
line-height: 17px;
opacity: 1;
opacity: 0.6;
text-align: left;
text-overflow: ellipsis;
display: -webkit-box;
Expand Down Expand Up @@ -83,15 +83,22 @@
.book-cover-item-desc {
width: 240px;
margin-top: 5px;
height: 68px;
font-size: 13px;
line-height: 17px;
opacity: 1;
opacity: 0.6;
text-align: left;
position: relative;
overflow-y: scroll;
float: left;
overflow-x: hidden;
height: 52px;
}
.book-cover-item-desc-detail {
width: 100%;
height: 100%;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
@keyframes slide-down {
0% {
Expand Down
16 changes: 8 additions & 8 deletions src/components/bookCoverItem/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import { withRouter } from "react-router-dom";
import RecordLocation from "../../utils/readUtils/recordLocation";
import { isElectron } from "react-device-detect";
import EmptyCover from "../emptyCover";
import Parser from "html-react-parser";
import * as DOMPurify from "dompurify";

import { Trans } from "react-i18next";
import BookUtil from "../../utils/fileUtils/bookUtil";
import toast from "react-hot-toast";
Expand All @@ -26,6 +23,7 @@ class BookCoverItem extends React.Component<BookCoverProps, BookCoverState> {
left: 0,
top: 0,
direction: "horizontal",
desc: "",
};
}

Expand Down Expand Up @@ -136,6 +134,10 @@ class BookCoverItem extends React.Component<BookCoverProps, BookCoverState> {
).percentage;
}
}
var htmlString = this.props.book.description;
var div = document.createElement("div");
div.innerHTML = htmlString;
var textContent = div.textContent || div.innerText;
const actionProps = { left: this.state.left, top: this.state.top };
return (
<>
Expand Down Expand Up @@ -253,11 +255,9 @@ class BookCoverItem extends React.Component<BookCoverProps, BookCoverState> {
</p>
<div className="book-cover-item-desc">
<Trans>Description</Trans>:&nbsp;
{this.props.book.description ? (
Parser(DOMPurify.sanitize(this.props.book.description))
) : (
<Trans>Empty</Trans>
)}
<div className="book-cover-item-desc-detail">
{this.props.book.description ? textContent : <Trans>Empty</Trans>}
</div>
</div>
</div>
{this.props.isOpenActionDialog &&
Expand Down
1 change: 1 addition & 0 deletions src/components/bookCoverItem/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export interface BookCoverState {
left: number;
top: number;
direction: string;
desc: string;
}
73 changes: 22 additions & 51 deletions src/components/bookListItem/bookListItem.css
Original file line number Diff line number Diff line change
@@ -1,59 +1,40 @@
.book-list-item-container {
margin: 18px;
margin: 12px;
margin-right: 25px;
position: relative;
max-height: 74px;
}
.book-item-list-cover {
width: 57px;
height: 74px;
width: 43px;
/* height: 74px; */
opacity: 1;
cursor: pointer;
/* overflow: hidden; */
border-radius: 1px;
float: left;
margin-right: 15px;
display: inline-block;
margin-right: 12px;
}

.book-item-list-title,
.book-item-list-author {
max-height: 60px;
font-size: 15px;
opacity: 1;
text-align: left;
vertical-align: middle;
cursor: pointer;
margin: 7px 10px;
line-height: 20px;
word-wrap: break-word;

overflow: hidden;
}
.book-item-list-title {
display: inline-block;
width: calc(100% - 350px);
text-align: left;
}
.book-item-list-subtitle {
display: table-cell;
vertical-align: middle;
height: 60px;
width: 100%;
width: calc(100% - 80px);
position: absolute;
top: 0px;
left: 60px;
font-size: 15px;
}
.book-item-list-author {
width: 150px;
float: right;
display: table;
.book-item-list-subtitle,
.book-item-list-author,
.book-item-list-percentage {
height: 22px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.book-item-list-date,
.book-item-list-config {
height: 25px;
min-width: 180px;
font-size: 15px;
opacity: 1;
text-align: center;
margin: 22px 10px;
line-height: 38px;
.book-item-list-author,
.book-item-list-percentage {
opacity: 0.6;
font-size: 10px;
height: 18px;
}
.book-item-list-config {
cursor: pointer;
Expand All @@ -62,13 +43,3 @@
margin: 15px 10px;
font-size: 20px;
}
.book-item-list-percentage {
max-width: 50px;
height: 30px;
font-size: 15px;
opacity: 1;
text-align: center;
margin: 22px 10px;
line-height: 30px;
float: right;
}
Loading

0 comments on commit c5c5657

Please sign in to comment.