Closed bamboospirit closed 3 years ago
Great, thank you!
with pleasure, I've been using it like this:
(defparameter *allowed-files* ".*.(txt|gif|bmp|png|jpg|css|js)")
(weblocks-file-server:make-route :uri "/res/" :root (merge-pathnames *proj-dir* #p"res") :dir-listing t :filter *allowed-files*)
(setf weblocks/js/jquery::*js-dependencies*
(list (make-dependency "res/lib/jquery/jquery-1.8.2.js"
;; :integrity "sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
:system :mysystem)
...)
It does it's job of serving files recursively
( I just found a small issue, when dir-listing is t , it doesn't display children directories, only children files . It can be easily fixed, if anyone needs to use it as a "complete" file browser. I only use it to serve files )
Added regexp based file filter and a boolean flag to show/hide file listing (useful when you want to share only certain files and you don't want to disclose the whole directory)
Example: (weblocks-file-server:make-route :uri "/static/" :root "/tmp/" :dir-listing nil :filter "..txt") ; now access 127.0.0.1/static/1.txt (weblocks-file-server:make-route :uri "/static/" :root "/tmp/" :dir-listing t :filter "..gif") ; now access 127.0.0.1/static/2.gif and 127.0.0.1/static/ ; in this example, we display and give access to all files except for .txt : (weblocks-file-server:make-route :uri "/static/" :root "/tmp/" :dir-listing t :filter ".*.txt" :filter-type nil)