Skip to content

Commit ea1fc81

Browse files
committed
perf & chore & etc: Change version to 1.5.0
1 parent c3e1661 commit ea1fc81

13 files changed

Lines changed: 32 additions & 21 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ferrum",
3-
"version": "0.1.0",
3+
"version": "1.5.0",
44
"private": true,
55
"dependencies": {
66
"@babel/core": "7.12.3",

src/client/components/FerrumPlugin.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ import {
99
GetDataUrlResponse
1010
} from "../types";
1111
import * as config from "../../config.json";
12+
import { apiUrl } from "../global";
1213

13-
export const hostname = "http://"+ window.location.hostname;
14-
const apiUrl = hostname +":3301";
1514
const root = config.explorer.root;
1615

1716
export default abstract class FerrumPlugin extends Component<FerrumPluginProps, FerrumPluginState> {

src/client/components/ListItem.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import Axios from "axios";
55

66
import Utils from "../../Utils";
77
import { ListItemProps, ListItemState } from "../types";
8-
9-
const hostname = "http://"+ window.location.hostname;
10-
const apiUrl = hostname +":3301";
8+
import { apiUrl } from "../global";
9+
import Emitter from "../emitter";
1110

1211
export default class ListItem extends Component<ListItemProps, ListItemState> {
1312
private itemSize: string;
@@ -55,7 +54,7 @@ export default class ListItem extends Component<ListItemProps, ListItemState> {
5554
error: "重命名失败"
5655
}).then(() => {
5756
this.renameBoxSwitch();
58-
document.dispatchEvent(new CustomEvent("fileListUpdate"));
57+
Emitter.get().emit("fileListUpdate");
5958
});
6059
}
6160

src/client/components/StarredItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, ReactElement } from "react";
22
import { ListGroup } from "react-bootstrap";
33

4-
import { hostname } from "../pages/Explorer";
4+
import { hostname } from "../global";
55
import { StarredItemProps } from "../types";
66
import * as config from "../../config.json";
77

src/client/containers/explorer/RightSidebar.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { Component, ReactElement } from "react";
22
import { FilePond } from "react-filepond";
33

4+
import Emitter from "../../emitter";
45
import {
56
ExplorerRightSidebarProps,
67
ExplorerRightSidebarState,
78
SysInfo
89
} from "../../types";
10+
import { version, apiUrl } from "../../global";
911

10-
const apiUrl = "http://"+ window.location.hostname +":3301";
1112
const defaultSysInfo: SysInfo = {
1213
system: "",
1314
version: "",
@@ -40,7 +41,7 @@ export default class RightSidebar extends Component<ExplorerRightSidebarProps, E
4041
}
4142

4243
private handleUpload(): void {
43-
document.dispatchEvent(new CustomEvent("fileListUpdate"));
44+
Emitter.get().emit("fileListUpdate");
4445
}
4546

4647
public render(): ReactElement | null {
@@ -57,6 +58,7 @@ export default class RightSidebar extends Component<ExplorerRightSidebarProps, E
5758
data="https://img.shields.io/github/stars/NriotHrreion/ferrum.svg?style=social&label=Star"
5859
aria-label="Github Stars"></object>
5960
<a href="/license">许可</a>
61+
<span>Ver: {version}</span>
6062
</p>
6163
</div>
6264
<div className="right-sidebar-panel upload-container">

src/client/containers/explorer/ToolButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, ReactElement } from "react";
22
import { Button } from "react-bootstrap";
33

4-
import { hostname } from "../../pages/Explorer";
4+
import { hostname } from "../../global";
55
import { ExplorerToolButtonsProps } from "../../types";
66

77
export default class ToolButtons extends Component<ExplorerToolButtonsProps, {}> {

src/client/global.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const version = "1.5.0";
2+
export const hostname = "http://"+ window.location.hostname;
3+
export const apiUrl = hostname +":3301";

src/client/pages/Editor.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ import Header from "../containers/editor/Header";
1010
import { theme } from "../theme";
1111

1212
import { EditorProps, EditorState, GetFileContentResponse } from "../types";
13+
import { apiUrl } from "../global";
1314
import * as config from "../../config.json";
1415

15-
const hostname = "http://"+ window.location.hostname;
16-
const apiUrl = hostname +":3301";
1716
const root = config.explorer.root;
1817

1918
export default class Editor extends Component<EditorProps, EditorState> {

src/client/pages/Explorer.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Component, ReactElement } from "react";
22
import { toast, Toaster } from "react-hot-toast";
33
import Axios from "axios";
4+
import md5 from "md5-node";
45

56
// components
67
import ListItem from "../components/ListItem";
@@ -14,17 +15,16 @@ import LeftSidebar from "../containers/explorer/LeftSidebar";
1415
import RightSidebar from "../containers/explorer/RightSidebar";
1516

1617
import Utils from "../../Utils";
18+
import Emitter from "../emitter";
1719
import { FetchDirInfoResponse, ExplorerProps, ExplorerState } from "../types";
20+
import { hostname, apiUrl } from "../global";
1821
import * as config from "../../config.json";
1922
import { plugins } from "../../plugins";
2023

2124
// icons
2225
import starOutline from "../../icons/star_outline.svg";
2326
import starRate from "../../icons/star_rate.svg";
24-
import md5 from "md5-node";
2527

26-
export const hostname = "http://"+ window.location.hostname;
27-
const apiUrl = hostname +":3301";
2828
const root = config.explorer.root;
2929

3030
export default class Explorer extends Component<ExplorerProps, ExplorerState> {
@@ -308,7 +308,8 @@ export default class Explorer extends Component<ExplorerProps, ExplorerState> {
308308
}
309309
});
310310

311-
document.addEventListener("fileListUpdate", () => this.refreshItemList());
311+
// document.addEventListener("fileListUpdate", () => this.refreshItemList());
312+
Emitter.get().on("fileListUpdate", () => this.refreshItemList());
312313

313314
this.refreshItemList();
314315
this.refreshStarredList();

src/client/pages/PictureViewer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ import Header from "../containers/pictureViewer/Header";
99
import transparentImage from "../../icons/transparent.png";
1010

1111
import { PictureViewerProps, PictureViewerState, GetDataUrlResponse } from "../types";
12+
import { apiUrl } from "../global";
1213
import * as config from "../../config.json";
1314

14-
const hostname = "http://"+ window.location.hostname;
15-
const apiUrl = hostname +":3301";
1615
const root = config.explorer.root;
1716

1817
export default class PictureViewer extends Component<PictureViewerProps, PictureViewerState> {

0 commit comments

Comments
 (0)