liplum / Meditree

Share your media anywhere in a tree with various backends and frontends.

Home Page:https://liplum.github.io/Meditree/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Meditree

Backend

Node.js /backend-js

This is an Express.js server that provides the following features:

  1. It serves a local file tree on the file system and monitors changes made to it.
  2. It supports plugins to add more features.

To learn more about backend-js, please refer to its README.

Go /backend-go

To learn more about backend-go please refer to its README.

Frontend

React /web-react

This is a single-page application (SPA) created with JavaScript and React Functional Component. It offers the following features:

  1. A directory-tree-like view that makes it easy to browse files in one place.
  2. Case-insensitive file search in the root directory.
  3. Client-side routing for a better loading experience and to reduce server-side overhead.
  4. The same URL will end up with the same file. This can be shared across web-react and web-vue.

To learn more about web-react please refer to its README.

Vue /web-vue

This is a single-page application (SPA) created with TypeScript and Vue3 Composition API. It offers the following features:

  1. A file-explorer-like view makes more sense for users.
  2. Case-insensitive file search in the current directory.
  3. Client-side routing for a better loading experience and to reduce server-side overhead.
  4. The same URL will end up with the same file. This can be shared across web-react and web-vue.

To learn more about web-vue please refer to its README.

Application

Flutter /app-flutter

To learn more about app-flutter please refer to its README.

Deployment

You can combine ANY frontend implmenetation with ANY backend implmenetation on the same server or multiple servers for free.

Here's an example to deploy the backend-js + web-react + nginx.

First, run npm run build to build the bundled production of web-react.

Then you can configure the meditree.json like below. Note when you runs the backend-js, some essential settings will be generated on the fly.

{
  "name": "My-Meditree", // Name to show.
  "port": 8080, // 8080 doesn't require sudo on linux.
  "root": "/path/to/root", // [optional] the root direcotry of a local file tree.
  "plugin": {
    "homepage": { // Use homepage plugin to serve a static webiste.
      "root": "/path/to/web-react/dist"
    },
    "watch": true // Use watch plugin to watch local file changes.
  }
}

After configuring, run npm start in backend-js. You can access the "http://localhost:8080" to check if the homepage is available, and access "http://localhost:8080/list" to ensure the backend is working.

Finally, configure the nginx for port forwarding.

server {
    listen 80;
    server_name your_site.com;

    # For example, serving the backend on 8080 port locally, and proxy it to 80 port and "/" externally.
    location / {
        proxy_pass http://localhost:8080;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Interface

Payload structure

interface File {
  "*type": string
  "*tag"?: Record<string, number | string | boolean>
  "*hide"?: boolean
  size?: number
}

interface Directory {
  "*tag"?: Record<string, number | string | boolean>
  "*hide"?: boolean
  [name: string]: File | Directory | Directory["*tag"] | Directory["*hide"]
}

Example

{
  "name": "MyServer",
  "root": {
      // path: `/myText.txt`
      "myText.txt": {
        "*type": "text/plain",
      },
      // path: `/myFolder`
      "myFolder": {
        // path: `/myFolder/myVideo.mp4`
        "myVideo.mp4": {
          "*type": "video/mp4",
        }
      }
  }
}

About

Share your media anywhere in a tree with various backends and frontends.

https://liplum.github.io/Meditree/


Languages

Language:TypeScript 48.7%Language:Dart 16.3%Language:C++ 7.3%Language:JavaScript 6.9%Language:CMake 6.0%Language:CSS 5.2%Language:Vue 5.1%Language:Go 1.6%Language:Kotlin 1.0%Language:HTML 0.9%Language:Swift 0.6%Language:C 0.4%Language:Objective-C 0.0%