faustinoaq changed the topic of #amber to: Welcome to Amber Framework community! | https://amberframework.org | Developer happiness, productivity and bare metal performance | GH: https://github.com/amberframework | Docs: https://docs.amberframework.org | Gitter: https://gitter.im/amberframework/amber | IRC Logger: https://irclog.whitequark.org/amber | Amber::Server.start
<FromGitter> <rmarronnier> '''instantiating 'Amber::Pipe::Pipeline#build(Symbol)' ⏎ in config/routes.cr:24: no overload matches 'Amber::Pipe::CORS.new' with type String ⏎ Overloads are: ⏎ ⏎ 1) Amber::Pipe::CORS.new(origins : OriginType = ["*", %r()], methods = ALLOW_METHODS, headers = ALLOW_HEADERS, credentials = false, max_age : Int32 | ::Nil = 0, expose_headers : Array(String) | ::Nil = nil, vary : String | ::Nil = nil) ...
<FromGitter> <rmarronnier> Is there an example of how to initialize an OriginType object ?
<FromGitter> <rmarronnier> This looks cryptic to me : ''["*", %r()]''
<FromGitter> <rmarronnier> I got this pipe working, but without putting any arguments (not safe :-) )
<FromGitter> <Blacksmoke16> sec
<FromGitter> <Blacksmoke16> it just an alias for `Array(String | Regex)` @rmarronnier
<FromGitter> <Blacksmoke16> default value is `"*"` and empty regex that would match everything
<FromGitter> <nsuchy> Hi so I really like Amber so far and it's working great. I want to implement file upload and make sure that only an authenticated user can download a file. I already have a `current_user` method. How might I go about restricting who can and cannot download a specific file?
<FromGitter> <nsuchy> I'd also like to check against its database entry to make sure `is_deleted` is set to false
<FromGitter> <nsuchy> if anyone has published a project on GitHub that makes use of file uploads I'd like to see :)
<FromGitter> <Blacksmoke16> What form of auth are you using?
<FromGitter> <Blacksmoke16> Probably would have to setup some form of permissions then check it before processing the request.
<FromGitter> <Blacksmoke16> I'm unsure if there is anything built in to help with that
<FromGitter> <Blacksmoke16> deleted_at might work better as well, same idea but you also get record of when it was deleted
<FromGitter> <nsuchy> I'm using Amber's auth generator
<FromGitter> <nsuchy> I saw the cookbook entry already, was more of looking to write a route that looks up a database entry by id then checks that it's not soft deleted then finally returns the file if all checks pass
<FromGitter> <Blacksmoke16> pull param from url, do a db query like `Model.where(deleted_at: nil)`
<FromGitter> <Blacksmoke16> or whatever your query would be
<FromGitter> <Blacksmoke16> i guess more like `Model.find_by(deleted_at: nil, id: params[:id])`
<FromGitter> <Blacksmoke16> which then could do like
_whitelogger has joined #amber
<FromGitter> <Blacksmoke16> anyway im off to bed
<FromGitter> <pynixwang> granite now has no lock impliment
<FromGitter> <anamba> hi all, long time. just a quick mention in case anyone is in a similar situation. i needed to work with liquid templates and TechMagister's shard was a decent starting point, but nowhere near usable for what i'm doing, so i've been hacking at it on my own: https://github.com/anamba/liquid.cr hoping to merge back someday, but not really my top priority at the moment
<FromGitter> <silmanduin66> hi, i have a webpack question. Amber generates a main.bundle.js file . I' m trying to export a function with ⏎ ⏎ ```export function hello() { ⏎ console.log("hello"); ⏎ }``` [https://gitter.im/amberframework/amber?at=5cb56e7c93fb4a7dc238bed8]
<FromGitter> <silmanduin66> and i got this in the ```main.bundle.js```
<FromGitter> <silmanduin66> ```code paste, see link```
<FromGitter> <silmanduin66> can anyone tell me how can i use that function ?
<FromGitter> <anamba> webpack makes cry. i use faucet
<FromGitter> <anamba> https://www.faucet-pipeline.org/
<FromGitter> <damianham> @silmanduin66 just import the hello method from the file it is defined in wherever you need to use it ⏎ ⏎ ```import { hello } from 'path/to/hello' ⏎ ⏎ hello()``` [https://gitter.im/amberframework/amber?at=5cb571771f6e900d5e3eb701]
<FromGitter> <silmanduin66> i am not importing it from another file and that is the problem. In the same ```main.bundle.js``` I am generating HTML code like this ⏎ ⏎ ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5cb57284c55bd14d35f20c08]
<FromGitter> <silmanduin66> the problem is that my hello function within is not accessible by my ```onclick``` within the same file
<FromGitter> <damianham> @anamba I sent you an invite to AmberCommunity - it might be a good idea to add your liquid shard to AmberCommunity as we use liquid for recipes so it would be a good candidate for us to maintain collectively.
<FromGitter> <damianham> @silmanduin66 what is your front end environment ? I can't forsee a need to ever look at the contents of the bundle.
<FromGitter> <damianham> @mixflame I had a look at some of the commits in other forks but I am unsure about which ones are good candidates to merge in. I suppose I could ask the fork authors for the reasoning behind their changes.
<FromGitter> <silmanduin66> I am not using anything else other than the amber.js, all my code is self made (i'm coding from scratch in js since i m thinking to rewrite this later for WebAssembly )
<FromGitter> <silmanduin66> ok i used this simple ⏎ ⏎ ```window.hello = hello;``` ⏎ ⏎ it may not be optimal but it s working for the moment [https://gitter.im/amberframework/amber?at=5cb5772f20fbe911eec2cd78]
<FromGitter> <rmarronnier> @Blacksmoke16 thanks, gonna check this tonight
feepbot has quit [Ping timeout: 250 seconds]
feepbot has joined #amber
_whitelogger has joined #amber
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <mixflame> @damianham I'm personally unsure what the edits would have been. @sam0x17 might know more. if not I guess we will fix stuff when we run into it
<FromGitter> <mixflame> i haven't run into anything in livepost
<FromGitter> <ikaru5> Hello guys :D ⏎ Just started learning amber. Coming from Rails I have a question: Is there anything like jobs? ⏎ Or another scheduling technology? Im trying to port my Rails-Web-Game to amber and need something to run every few seconds... ⏎ Or should I just create a seperate file with a combination of loop and wait and run it in an own thread? [https://gitter.im/amberframework/amber?at=5cb610cdb4700e023d81a607]
<FromGitter> <Blacksmoke16> @ikaru5 id check out https://github.com/robacarp/mosquito
<FromGitter> <ikaru5> @Blacksmoke16 Thank you! Exactly what I was looking for! :)
<FromGitter> <Blacksmoke16> np
<FromGitter> <nsuchy> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5cb62ac9b489bb6ed774f068]
<FromGitter> <nsuchy> I'm getting that error when I attempt to create a form
<FromGitter> <nsuchy> I'm using ECR not Slang
<FromGitter> <Blacksmoke16> `%>` isnt a valid ending
<FromGitter> <Blacksmoke16> based on the start `<%=` tag
<FromGitter> <Blacksmoke16> nvm
<FromGitter> <Blacksmoke16> i misread the docs :p
<FromGitter> <nsuchy> Lol
<FromGitter> <nsuchy> Do the jasper helpers not work with ECR?
<FromGitter> <nsuchy> I could write manual forms
<FromGitter> <nsuchy> At which point I have to figure out the CSRF stuff
<FromGitter> <Blacksmoke16> tbh i have no idea, if you have any Granite/ORM/DB questions ill be more useful :P
<FromGitter> <Blacksmoke16> or amber-router
<FromGitter> <mixflame> better to make your own forms and use <%= crsf_tag %>
<FromGitter> <mixflame> easy
<FromGitter> <mixflame> read my source @nsuchy, I use ECR https://github.com/mixflame/livepost
<FromGitter> <nsuchy> Thank you
<FromGitter> <nsuchy> maybe I'll write my own ECR form generator library
<FromGitter> <nsuchy> ```Post.all("WHERE id = ?", [params[:id]]).first.update(is_deleted: true)```
<FromGitter> <nsuchy> Is that handling the issue of SQL Injection properly?
<FromGitter> <Blacksmoke16> should be yes
<FromGitter> <Blacksmoke16> but you could just do `Post.find params[:id]`
<FromGitter> <Blacksmoke16> er
<FromGitter> <Blacksmoke16> `Post.find!(params[:id]).update(is_deleted: true)`
<FromGitter> <Blacksmoke16> `find!` saying to raise on error if it doesnt exist, prob should do some logic to make sure that post exists first
<FromGitter> <Blacksmoke16> and maybe use `deleted_at` timestamp instead?
<FromGitter> <Blacksmoke16> same idea but gives more context of when it got deleted
<FromGitter> <nsuchy> ```code paste, see link``` [https://gitter.im/amberframework/amber?at=5cb63e606a84d76ed8a50a2b]
<FromGitter> <nsuchy> any idea what's happening here?
<FromGitter> <Blacksmoke16> shit broke yo
<FromGitter> <Blacksmoke16> i can honestly say i have never seen that error
<FromGitter> <Blacksmoke16> *what have you done* :P
<FromGitter> <nsuchy> It happens when I added `is_deleted` to my query
<FromGitter> <nsuchy> ```user = User.find_by(email: params["email"].to_s, is_deleted: false)```
<FromGitter> <Blacksmoke16> can you see if you can reproduce it outside of amber? i.e. create a new file define your db adapter, create the model, then try the query?
<FromGitter> <nsuchy> yeah
<FromGitter> <Blacksmoke16> 👍
<FromGitter> <Blacksmoke16> @nsuchy any luck?