fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
magra 2020-10-22T09:03:26.388100Z

What would be a good approach to (rarely) upload a pdf from a fulcro app to the server when I use fulcro-websocket remote? The upload-file namespace needs http-remote. Are there writers to serialize and where would I plug them in and what format would make sense? Or do I register a second remote as http-remote to the same server for uploads since uploads will happen only rarely?

2020-10-22T09:18:46.388700Z

@magra I'd go for the second option, you could use the examples for a file upload remote and not have to adjust it much.

šŸ™ 1
exit2 2020-10-22T13:48:29.389600Z

Has anyone had any success using https://github.com/cemerick/friend w/ http-kit and fulcro3?

tvaughan 2020-10-22T15:11:56.390300Z

We chose buddy, and we're happy with it

šŸ‘ 1
exit2 2020-10-22T19:30:21.391600Z

@tvaughan do you have it thread in the middleware or where did you place it? I’m looking at some of their examples and trying to figure out where it would fit

tvaughan 2020-10-22T19:32:46.391800Z

(defn- auth-required?
  [segment]
  ;; `accounts` and `static` are used to render the signin page, and `sessions`
  ;; is the API endpoint used to authenticate users and create sessions.
  (not-in? segment ["accounts" "static" "sessions"]))

(defn- check-auth-required
  [handler]
  (fn [request]
    (let [segment (nth (str/split (:uri request) #"/" 3) 1)]
      (if (and (auth-required? segment) (not (authenticated? request)))
        (if (in? segment ["api" "static"])
          (response/unauthorized)
          (response/found (urls/route->url (dr/path-to ui/SignIn))))
        (handler request)))))

(defonce ^:private session-auth-backend (backends/session))

(defn wrap-check-auth-required
  [handler {:keys [session-secret]}]
  (-> handler
      check-auth-required
      (wrap-authentication session-auth-backend)
      (wrap-session {:store (cookie-store {:key (s->bytes session-secret)})
                     :cookie-attrs {:http-only true :same-site :strict}})))

tvaughan 2020-10-22T19:33:22.392Z

middelware

šŸ‘ 1
exit2 2020-10-22T19:48:14.392300Z

thanks @tvaughan

tvaughan 2020-10-22T19:49:08.392500Z

No problem. I hope it's helpful