Coder Social home page Coder Social logo

tradit-tpl's Introduction

Tradit-TPL

Use an HFS 2 'template' in HFS 3 - PRE-ALPHA stage

Note: big changes expected, see issue #4

Features

  • Speed! Always response within 10ms then stream the page
    (without file sorting, though not implemented yet)
  • Different "macro" concept, not interpreted but executed
    (code describes best; or just feel it)

Try it out

For it's way too early, not put to HFS "search online" list yet.

  1. Get HFS 0.23.0 or later, set it up.
  2. Clone (or download archive of) this repository
  3. Copy the dist folder to HFS plugin folder, rename as Tradit-TPL
  4. Launch HFS, go to admin UI, Plugin panel, enable this plugin
    First start will auto search & use the present bare.tpl for demo purpose
  5. Go to "Shared Files" panel, put some files/folders
  6. Browse files. See if it works
  7. prepare & go to a folder with music files, and enjoy the music player (will appear at left-bottom corner)

To change template, in Plugin panel, configure this plugin and pick other desired template file.

But currently none of existing templates will work perfectly.

Q&A

Expand Q&A

Why "Tradit-TPL"?
I casually took it from word "traditional". But that word is not the case -- we have new way.
And pronounce that "tra" as in "trap".

How to use bare.tpl music player?

Left click play next
Right click pause/continue
Middle click
(press wheel)
sequence/shuffle playlist

Why don't go straight with existing template techniques, e.g. of Delphi/HFS or Python/HFS?
You may have heard about bad side about HFS performance: most because UI/Server threading problem, the other is imperformant template interpretation.
The former is (hopefully) solved by Node/HFS, so let's do the later.
And now I want something completely different :D

Why stay with that weird HFS macro? Shouldn't there be a better thing?
I personally think that, reasonable philosophy won't die. By learning from pure faith, we won't lose direction.
But, though, I have a language idea for macro/template/general-html. It have form, but still a bit unclear.
Further suggestions are welcome!

Is it secure enough?
Since it's non-production, it yet can't be determined.
But it's certainly true that so-called "injection" won't work!
Leave away from those tech imps. Test your case with good tools like OWASP ZAP, not a mouth.


Dev

  • Prepare: cd to repo, npm install
  • Transpile: npx tsc
Tips for Linux/*nix

Symlinking dist to plugin folder as Tradit-TPL helps.

Under X11 (yes, neither Windows/Wine nor Wayland), HFS can't reload correctly with npx tsc --watch, after 2 times.
Assign a keybinding to your DE (like KDE Plasma) to run touch /<DEV_PATH_HERE>/Tradit-TPL/dist/plugin.js. My choice is Ctrl+Alt+Shift+S.


Far more things are going to be changed, and many macros are not implemented yet.

Don't pay too much attention as for now...

Yawn... Bed time...

tradit-tpl's People

Contributors

naitlee avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

rejetto

tradit-tpl's Issues

plugin path

export const PLUGIN_PATH = ['.', 'plugins', 'Tradit-TPL', ''].join(PATH_DELIM);

you'd better use __dirname to tell where your tpl is.
It's neater, but also your folder may have a different name when downloaded.

Planned changes & Planned features ๐Ÿฃ

The code can work.

Though I want to make following changes, for less overhead ("pre-mature optimization"), or at least to try out new things:

  • Implement most macros in WebAssembly, with AssemblyScript. Notably non-async & trivial ones.

    • Sync & trivial e.g. add, replace, urlvar
    • Async e.g. %list% (symbols are also macros here)
  • Only optimize macro if all its parameters are "known"

    • like {.replace|a|b|c|d|abc.} and {.add|1|{.add|1|1.}.}
    • but not {.replace|a|{.urlvar|b.}|c|d|abc.}

The bad side:

  • Regular Expressions used in serializer are potentially buggy.
  • Many features are not implemented: special:alias etc. etc.
  • Should harden security more.
  • No document yet.
  • No real "use cases" yet, i.e. need a good template to show off :)

... These will be done step by step.

Some dev "flags":

  • A custom configuration page, like HFS Admin
    • Of course security will be considered
  • Extended features (for templates) to provide flexibility, but compatible to HFS 2.4
    • something like [special:strings;zh-CN] to do better backend localization (when see HTTP header Accept-Language: zh-CN)
    • optional feature flags in section [special:features] to request different behavior. Example:
      • no-sort for by default preventing backend from sorting file list (to save resource) (in this case browser/client do it)
  • Some good templates to make use of these

Not in a hurry. But wouldn't it be great?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.