Skip to content

Commit

Permalink
perf & chore & etc: Change version to 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
NriotHrreion committed Jun 9, 2022
1 parent c3e1661 commit ea1fc81
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 21 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ferrum",
"version": "0.1.0",
"version": "1.5.0",
"private": true,
"dependencies": {
"@babel/core": "7.12.3",
Expand Down
3 changes: 1 addition & 2 deletions src/client/components/FerrumPlugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import {
GetDataUrlResponse
} from "../types";
import * as config from "../../config.json";
import { apiUrl } from "../global";

export const hostname = "http://"+ window.location.hostname;
const apiUrl = hostname +":3301";
const root = config.explorer.root;

export default abstract class FerrumPlugin extends Component<FerrumPluginProps, FerrumPluginState> {
Expand Down
7 changes: 3 additions & 4 deletions src/client/components/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import Axios from "axios";

import Utils from "../../Utils";
import { ListItemProps, ListItemState } from "../types";

const hostname = "http://"+ window.location.hostname;
const apiUrl = hostname +":3301";
import { apiUrl } from "../global";
import Emitter from "../emitter";

export default class ListItem extends Component<ListItemProps, ListItemState> {
private itemSize: string;
Expand Down Expand Up @@ -55,7 +54,7 @@ export default class ListItem extends Component<ListItemProps, ListItemState> {
error: "重命名失败"
}).then(() => {
this.renameBoxSwitch();
document.dispatchEvent(new CustomEvent("fileListUpdate"));
Emitter.get().emit("fileListUpdate");
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/client/components/StarredItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, ReactElement } from "react";
import { ListGroup } from "react-bootstrap";

import { hostname } from "../pages/Explorer";
import { hostname } from "../global";
import { StarredItemProps } from "../types";
import * as config from "../../config.json";

Expand Down
6 changes: 4 additions & 2 deletions src/client/containers/explorer/RightSidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { Component, ReactElement } from "react";
import { FilePond } from "react-filepond";

import Emitter from "../../emitter";
import {
ExplorerRightSidebarProps,
ExplorerRightSidebarState,
SysInfo
} from "../../types";
import { version, apiUrl } from "../../global";

const apiUrl = "http://"+ window.location.hostname +":3301";
const defaultSysInfo: SysInfo = {
system: "",
version: "",
Expand Down Expand Up @@ -40,7 +41,7 @@ export default class RightSidebar extends Component<ExplorerRightSidebarProps, E
}

private handleUpload(): void {
document.dispatchEvent(new CustomEvent("fileListUpdate"));
Emitter.get().emit("fileListUpdate");
}

public render(): ReactElement | null {
Expand All @@ -57,6 +58,7 @@ export default class RightSidebar extends Component<ExplorerRightSidebarProps, E
data="https://img.shields.io/github/stars/NriotHrreion/ferrum.svg?style=social&label=Star"
aria-label="Github Stars"></object>
<a href="/license">许可</a>
<span>Ver: {version}</span>
</p>
</div>
<div className="right-sidebar-panel upload-container">
Expand Down
2 changes: 1 addition & 1 deletion src/client/containers/explorer/ToolButtons.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Component, ReactElement } from "react";
import { Button } from "react-bootstrap";

import { hostname } from "../../pages/Explorer";
import { hostname } from "../../global";
import { ExplorerToolButtonsProps } from "../../types";

export default class ToolButtons extends Component<ExplorerToolButtonsProps, {}> {
Expand Down
3 changes: 3 additions & 0 deletions src/client/global.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const version = "1.5.0";
export const hostname = "http://"+ window.location.hostname;
export const apiUrl = hostname +":3301";
3 changes: 1 addition & 2 deletions src/client/pages/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import Header from "../containers/editor/Header";
import { theme } from "../theme";

import { EditorProps, EditorState, GetFileContentResponse } from "../types";
import { apiUrl } from "../global";
import * as config from "../../config.json";

const hostname = "http://"+ window.location.hostname;
const apiUrl = hostname +":3301";
const root = config.explorer.root;

export default class Editor extends Component<EditorProps, EditorState> {
Expand Down
9 changes: 5 additions & 4 deletions src/client/pages/Explorer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, ReactElement } from "react";
import { toast, Toaster } from "react-hot-toast";
import Axios from "axios";
import md5 from "md5-node";

// components
import ListItem from "../components/ListItem";
Expand All @@ -14,17 +15,16 @@ import LeftSidebar from "../containers/explorer/LeftSidebar";
import RightSidebar from "../containers/explorer/RightSidebar";

import Utils from "../../Utils";
import Emitter from "../emitter";
import { FetchDirInfoResponse, ExplorerProps, ExplorerState } from "../types";
import { hostname, apiUrl } from "../global";
import * as config from "../../config.json";
import { plugins } from "../../plugins";

// icons
import starOutline from "../../icons/star_outline.svg";
import starRate from "../../icons/star_rate.svg";
import md5 from "md5-node";

export const hostname = "http://"+ window.location.hostname;
const apiUrl = hostname +":3301";
const root = config.explorer.root;

export default class Explorer extends Component<ExplorerProps, ExplorerState> {
Expand Down Expand Up @@ -308,7 +308,8 @@ export default class Explorer extends Component<ExplorerProps, ExplorerState> {
}
});

document.addEventListener("fileListUpdate", () => this.refreshItemList());
// document.addEventListener("fileListUpdate", () => this.refreshItemList());
Emitter.get().on("fileListUpdate", () => this.refreshItemList());

this.refreshItemList();
this.refreshStarredList();
Expand Down
3 changes: 1 addition & 2 deletions src/client/pages/PictureViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ import Header from "../containers/pictureViewer/Header";
import transparentImage from "../../icons/transparent.png";

import { PictureViewerProps, PictureViewerState, GetDataUrlResponse } from "../types";
import { apiUrl } from "../global";
import * as config from "../../config.json";

const hostname = "http://"+ window.location.hostname;
const apiUrl = hostname +":3301";
const root = config.explorer.root;

export default class PictureViewer extends Component<PictureViewerProps, PictureViewerState> {
Expand Down
2 changes: 1 addition & 1 deletion src/client/pages/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, ReactElement } from "react";
import openSocket from "socket.io-client";
import { Terminal as XTermTerminal } from "xterm";

import { hostname } from "../pages/Explorer";
import { hostname } from "../global";
import Utils from "../../Utils";
import * as config from "../../config.json";

Expand Down
5 changes: 5 additions & 0 deletions src/client/style/explorer.less
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,11 @@
vertical-align: bottom;
margin-right: 10px;
}
span {
float: right;
line-height: 30px;
font-size: 10pt;
}
}
.upload-container {
overflow-y: auto;
Expand Down
6 changes: 5 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ import * as config from "./config.json";
import Main from "./Main";
import Login from "./client/pages/Login";

import { version } from "./client/global";

if(window.location.pathname == "/" || window.location.pathname == "/dir") {
window.location.href = "/dir/"; // default page
}

console.log(
"%cFerrum Explorer %cBy NriotHrreion\n"+
"%cFerrum Explorer%cv"+ version +" | By NriotHrreion\n"+
"%c Website: https://nin.red/#/projects/ferrum/\n"+
"%cGithub Repo: https://github.com/NriotHrreion/ferrum\n",
"font-size: 16pt;font-weight: bold; padding: 10px",
"font-size: 8pt;color: gray",
"font-size: 8pt;color: white",
"font-size: 8pt;color: white"
);

Expand Down

0 comments on commit ea1fc81

Please sign in to comment.