Skip to content

Commit

Permalink
chore: Upgrade to 2.0.0a1 & docs: Change README & fix: Cannot change …
Browse files Browse the repository at this point in the history
…password in production mode & Build error
  • Loading branch information
NriotHrreion committed Aug 9, 2024
1 parent 5960ad2 commit d2c3acb
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 330 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ npminstall-debug.log
# local env files
.env
.env*.local
.pwd

# vercel
.vercel
Expand Down
File renamed without changes.
201 changes: 0 additions & 201 deletions README-zh_CN.md

This file was deleted.

125 changes: 17 additions & 108 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
<div align="center">

<img src="./public/logo256.png" style="width:82px;"/>
<img src="./public/icon.png" style="width:82px;"/>

# Ferrum Explorer

[![Author](https://img.shields.io/badge/Author-NriotHrreion-red.svg "Author")](https://github.com/NriotHrreion)
[![LICENSE](https://img.shields.io/badge/license-MIT-green.svg "LICENSE")](./LICENSE)
[![Stars](https://img.shields.io/github/stars/nocpiun/ferrum.svg?label=Stars)](https://github.com/nocpiun/ferrum/stargazers)
[![test](https://img.shields.io/github/actions/workflow/status/nocpiun/ferrum/ci.yml)](https://github.com/nocpiun/ferrum/actions/workflows/ci.yml)
[![test](https://img.shields.io/github/actions/workflow/status/nocpiun/ferrum/lint.yml)](https://github.com/nocpiun/ferrum/actions/workflows/lint.yml)
[![Netlify Status](https://api.netlify.com/api/v1/badges/e6af7829-7b1c-47ed-bf14-deb2b2d9648a/deploy-status)](https://app.netlify.com/sites/resonant-kitsune-43a162/deploys)

> Explore throughout your server
English | [中文](./README-zh_CN.md)

</div>

## Description

Ferrum Explorer is a web-based file explorer app for servers.

Because it's only maintained by me, so it has many problems and bugs. You can create a issue or pull request to tell me or fix it.
Because it's only maintained by me, so it might have some problems and bugs. You can raise an issue or create a pull request to tell me or fix it.

#### Why its name is Ferrum?

```
File Explorer -> FE -> Fe (Chemical Element) -> Ferrum
```

#### Can I have a look of it?

Demo: https://ferrum-demo.nin.red (The password is `123456`)

## Deploy & Use

First, you need to make sure that your server (or computer) has installed Nodejs.
Expand All @@ -42,17 +36,24 @@ First, you need to make sure that your server (or computer) has installed Nodejs
git clone https://github.com/nocpiun/ferrum.git
cd ferrum
npm i
npm run build
```

2. Run the app
2. Prepare the `.pwd` file

Rename the `.pwd.example` to `.pwd` in the project root folder. And delete the comments in it. This file stores your access key to Ferrum. The default password is `123456`, and you can change your password in the settings.

```txt
PASSWORD=....
```

3. Run the app (Recommended to use Administrator privilege)

```bash
npm run start
```

If you're using Linux, you need to add `sudo` before the command.

3. Enter `http://localhost:3300`, the default password is `123456`.
4. Enter `http://localhost:3300`.

### To get update

Expand All @@ -74,7 +75,7 @@ npm i --force

### Something to notice

Ferrum Explorer requires ports `3300` `3301` to launch. If you see it reports `address already in use :::xxxx`, you should have a check to whether you've launched Ferrum Explorer and whether other apps are using the ports. And see the following steps.
Ferrum Explorer requires ports `3300` to launch. If you see it reports `address already in use :::xxxx`, you should have a check to whether you've launched Ferrum Explorer and whether other apps are using the ports. And see the following steps.

**Windows**

Expand All @@ -90,91 +91,6 @@ lsof -i:[[here write the port it reported]]
kill -9 [[here write the PID the above command returned]]
```

If it reports `ENOSPC: System limit for number of file watchers reached, watch 'xxx'` and you're using Linux, please do:

```bash
sudo sysctl fs.inotify.max_user_watches=582222 && sudo sysctl -p
```

## Plugin

#### Write a Viewer Plugin

Viewer is a page that is shown when the user opens a file. The viewer's page will be shown when the user opens the file format(s) the viewer's option has specified. For example, a video viewer, its page will be shown when the user open a `.mp4` file.

You need to create a new `jsx` file. And a metadata list of the plugin is needed. (The following is a complete example).

```jsx
({
name: "example-viewer",
displayName: "Example Viewer",
setup({ addViewer }) {
addViewer({
id: "example-viewer", // The ID of your viewer
pageTitle: "Example Viewer", // This will be shown on the top of your viewer's page
route: "/example-viewer", // The route of your viewer's page
formats: [], // The formats that your viewer supports
render: (dataUrl) => <div>{dataUrl}</div> // The render of your viewer (`dataUrl` is a base64 data url)
});
}
})
```

Then, add your plugin in settings.

#### Plugin I18n

If you want to make your plugin supports different languages, just create a variable that stores your texts:

```jsx
const i18n = {
"zh-CN": {
"plugin.hello": "你好"
},
"en": {
"plugin.hello": "Hello"
}
};
```

Then, put this variable into your plugin metadata list:

```jsx
({
// ...
setup(apis) {
// ...
},
i18n, // <== Here
// ...
})
```

If you would like to use one of the texts in the i18n list, you just need to write down the key of the text and add a `$` before it. For example: `$plugin.hello`.

```jsx
({
// ...
setup({ addViewer }) {
addViewer({
// ...
pageTitle: "$plugin.hello", // <== Just like that
// ...
});
},
i18n,
// ...
})
```

## Testing

Ferrum Explorer is using Jest to test code.

```bash
npm run test
```

## Contributing

Contributions to Ferrum Explorer are welcomed. You can fork this project and start your contributing. If you don't know how to do, please follow the instruction [Creating a Pull Request from a Fork](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
Expand All @@ -187,15 +103,8 @@ An explanation of the `package.json` scripts.

- **`start`** Launch the app in production mode
- **`dev`** Launch the app in development mode
- **`server`** Only launch the server
- **`client`** Only launch the client
- **`build`** Create a production build (No using singly)
- **`build:netlify`** Create a production build (For the deployment of Netlify)
- **`test`** Run tests

## Note

> **Fun Fact:** This project learnt a lot from [Takenote](https://github.com/taniarascia/takenote). Takenote is also awesome.
- **`build`** Create a production build
- **`lint`** Run ESLint

## LICENSE

Expand Down
Loading

0 comments on commit d2c3acb

Please sign in to comment.