ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.31.1 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
ur5us has quit [Ping timeout: 245 seconds]
DTZUZO has quit [Quit: WeeChat 2.6]
DTZUZO has joined #crystal-lang
ur5us has joined #crystal-lang
f1reflyylmao has joined #crystal-lang
f1refly has quit [Ping timeout: 250 seconds]
ur5us has quit [Ping timeout: 245 seconds]
ht_ has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
_whitelogger has joined #crystal-lang
alexherbo2 has joined #crystal-lang
yukai has quit [Ping timeout: 276 seconds]
ur5us has joined #crystal-lang
alexherbo28 has joined #crystal-lang
alexherbo2 has quit [Ping timeout: 250 seconds]
sorcus has quit [Ping timeout: 245 seconds]
alexherbo28 has quit [Ping timeout: 250 seconds]
ur5us has quit [Ping timeout: 245 seconds]
alexherbo28 has joined #crystal-lang
alexherbo28 has quit [Ping timeout: 246 seconds]
<FromGitter> <jacobsun> Hi, what does the colon "(to:)" mean in `delegate each, to: @my_var`?
alexherbo28 has joined #crystal-lang
<FromGitter> <straight-shoota> @jacobsun It's a named argument. It essentially assigns the value `@my_var` to the argument `to`.
alexherbo28 has quit [Ping timeout: 245 seconds]
alexherbo28 has joined #crystal-lang
<alexherbo28> hi
<alexherbo28> I have a question about websocket
<alexherbo28> currently reading
<alexherbo28> I want to implement a websocket to execute shell commands
<alexherbo28> can a website, through javascript, connect to my localhost to execute commands?
<alexherbo28> as javascript is client side, if it has `new WebSocket(…)` to localhost to do nasty things, it's me who execute this code to do the nasty things?
<alexherbo28> or there is a cross domain security
<alexherbo28> I'm not sure
<alexherbo28> how to add auth (username, password) ?
livcd has quit [Quit: leaving]
livcd has joined #crystal-lang
foxxx0 has quit [Ping timeout: 245 seconds]
alexherbo28 has quit [Ping timeout: 268 seconds]
alexherbo28 has joined #crystal-lang
FromGitter has quit [Remote host closed the connection]
FromGitter has joined #crystal-lang
alexherbo28 has quit [Ping timeout: 268 seconds]
DTZUZO has quit [Ping timeout: 240 seconds]
<FromGitter> <Blacksmoke16> To http-Server?
alexherbo28 has joined #crystal-lang
alexherbo28 has quit [Quit: The Lounge - https://thelounge.chat]
alexherbo2 has joined #crystal-lang
Human_G33k has joined #crystal-lang
Human_G33k has quit [Remote host closed the connection]
Human_G33k has joined #crystal-lang
<repo> alexherbo2: do you _really_ want to do this? :d
<repo> sounds like a security nightmare
<alexherbo2> I'm not familiar with websocket
<alexherbo2> I want to execute shell commands from surf browser
<repo> but.. why?
<alexherbo2> so I thought I could communicate with websocket to execute shell commands
HumanG33k has quit [Ping timeout: 246 seconds]
<repo> why not ssh?
<alexherbo2> but I'm concerned with security issue
<repo> yes
<alexherbo2> repo ssh?
<repo> whops
<alexherbo2> basically I want from surf (https://surf.suckless.org) interact with javascript and execute shell commands with the data I have
<repo> o
<repo> ok
<alexherbo2> I'm used for ssh through the terminal, but ssh from javascript?
<repo> then i'd try to minimize attack vectors as much as possible
<alexherbo2> on chrome, there is a native messaging api to implement it, https://github.com/alexherbo2/chrome-shell/blob/master/host/src/chrome-shell.cr
<repo> 1. only allow a white list of commands. 2. make sure not to actually use a shell to execute them
<alexherbo2> but on surf, there is any api
<alexherbo2> it's for https://krabby.netlify.com
<repo> so for example if you'd support the `ls` command then have an explicit handling for this that will execute `ls` using Process.run(`ls`, arguments)
<alexherbo2> websocket looks cool for send/receiving messages
<alexherbo2> but I'm afraid of the security risk
<repo> important that you don't use backticks
<repo> or Process.run("foo bar baz")
<alexherbo2> what do you suggest?
<repo> as this will run it in a shell and open the door for users to send somehting like "foo; rm -rf --no-preserve-root /"
<alexherbo2> ideally I would like implement something similar to https://github.com/alexherbo2/chrome-shell/blob/master/host/src/chrome-shell.cr
<alexherbo2> for surf
<repo> do you really need a fully functioning shell in the browser?
<repo> that just sounds like a terrible idea :D
<alexherbo2> chrome make it secure because of its api
<repo> yeahhh well
<alexherbo2> surf I’m not sure of the approach
<alexherbo2> (how on crystal to handle username/password with websocket)?
<alexherbo2> on this code I'm not sure where to handle it
<alexherbo2> `var ws = new WebSocket("ws://username:password@example.com")`
<alexherbo2> where I can get the `username:password` part
<repo> alexherbo2: at least do some client certificate authentication
duane has quit [Ping timeout: 240 seconds]
sorcus has joined #crystal-lang
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/URI.html#user:String?-instance-method and `#password`
<FromGitter> <Blacksmoke16> from the URI you pass `HTTP::WebSocket.new`?
<FromGitter> <Ph055a> Hello, I am trying to use https://github.com/mamantoha/crest to make a simple GET requests so I can start playing around with crystal more but I'm stuck, it keeps returning a memory address instead of JSON. So what dumb simple thing am I missing here??? ⏎ ⏎ ```curl -L "http://httpbin.org/get?lang=en" ``` ⏎ ⏎ Thank you for any help, new at this crystal thing [https
<FromGitter> ... ://gitter.im/crystal-lang/crystal?at=5df101742bca3016aa605f7d]
<FromGitter> <Blacksmoke16> `puts a.gets_to_end`
duane has joined #crystal-lang
<FromGitter> <Blacksmoke16> or maybe `a.body`
<FromGitter> <Blacksmoke16> something like that
<FromGitter> <Ph055a> Doh!
<FromGitter> <Ph055a> It's ```a.body``` thanks
<FromGitter> <Ph055a> I should have guessed that
sagax has quit [Quit: Konversation terminated!]
<FromGitter> <Blacksmoke16> 👍 np
<FromGitter> <Blacksmoke16> in the future maybe use `pp` or `puts var.inspect`
<FromGitter> <Blacksmoke16> will give you a more expanded view of the obj, like ivars and stuff
<FromGitter> <Ph055a> OK, I need to learn to inspect the objects and ```gets_to_end``` is also a new one for me. More learning to be done :-)
<FromGitter> <Blacksmoke16> also depends on what you want to do with the body
<FromGitter> <Blacksmoke16> the type of `body` is most likely `IO`
<FromGitter> <Blacksmoke16> which some methods accept `IO | String`, such as `.from_json` or `JSON.parse`
<FromGitter> <Blacksmoke16> keeping it an `IO` would be the better option, but basically `#gets_to_end` just returns the `IO`'s content as a `String`. https://crystal-lang.org/api/master/IO.html#gets_to_end:String-instance-method
<alexherbo2> how to listen a specific path with websocket?
<alexherbo2> `ws://localhost:3001/foo`
<alexherbo2> I want to get 'foo'
<FromGitter> <Blacksmoke16> wouldn't you just new up a websocket with that uri?
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/HTTP/WebSocket.html#new(uri:URI%7CString,headers=HTTP::Headers.new)-class-method
<FromGitter> <Blacksmoke16> https://crystal-lang.org/api/master/HTTP/WebSocketHandler.html may also be helpful, idk much about websockets 😬
<alexherbo2> I want the wsUri being "ws://localhost:3000/something"
<alexherbo2> and on the server listen to something
<FromGitter> <vlazar> Oh, nice. The Christmass present is coming soon ❤️ https://github.com/crystal-lang/crystal/pull/8509
<FromGitter> <Blacksmoke16> alexherbo2: unfortunately i dont know much about web sockets, sorry :/
<alexherbo2> I'm looking for something similar to kemal `ws "/chat"`
<FromGitter> <Blacksmoke16> i think you would have to handle the routing part on your own?
<FromGitter> <Blacksmoke16> maybe look what kemal is doing under the hood
<alexherbo2> Blacksmoke16 do you think it is a bad idea to have the secret in the websocket path?
<FromGitter> <Blacksmoke16> env var would prob be better?
<alexherbo2> how?
<alexherbo2> I have a websocket server listening on localhost
<alexherbo2> I want to avoid websites I'm visiting using it
<alexherbo2> through javascript
<alexherbo2> so I got to implement a "secret"
<alexherbo2> currently I'm doing in the connection
<alexherbo2> with the socket path
<alexherbo2> how env var could help me?
fireglow has joined #crystal-lang
<FromGitter> <Blacksmoke16> in js it wouldn't
<FromGitter> <Blacksmoke16> again im prob not the best to ask for websocket help
<FromGitter> <Blacksmoke16> sorry
<FromGitter> <watzon> alexherbo2: This may be a good thing to read https://devcenter.heroku.com/articles/websocket-security
<alexherbo2> thanks watzon
ht_ has joined #crystal-lang
f1reflyylmao has quit [Quit: bye fags]
f1refly has joined #crystal-lang
DTZUZO has joined #crystal-lang
sagax has joined #crystal-lang
ht_ has quit [Remote host closed the connection]
ht_ has joined #crystal-lang
teardown is now known as knifehits
ur5us has joined #crystal-lang
<oz> Oh, 0.32 the 100th release. :)
DTZUZU has quit [Quit: WeeChat 2.6]
<FromGitter> <bew> 100th ?!
DTZUZU has joined #crystal-lang
<FromGitter> <bcardiff> I thought it was 101 :-P
<FromGitter> <bcardiff> well there is 1 test tag around and the ruby tag. so the count is slightly off. but yeah. almost 100
bcardiff has joined #crystal-lang
ChanServ changed the topic of #crystal-lang to: The Crystal programming language | http://crystal-lang.org | Crystal 0.32.0 | Fund Crystal's development: http://is.gd/X7PRtI | GH: https://github.com/crystal-lang/crystal | Docs: http://crystal-lang.org/docs/ | API: http://crystal-lang.org/api/ | Gitter: https://gitter.im/crystal-lang/crystal
bcardiff has quit [Client Quit]
ht_ has quit [Remote host closed the connection]
<FromGitter> <Blacksmoke16> @bcardiff does https://github.com/Homebrew/homebrew-core/pull/47747/files#diff-8044751bd6591e71649fccae7adb1bd7R55 need updated to `0.31.1` too?
duane has quit [Ping timeout: 265 seconds]
yukai has joined #crystal-lang
<FromGitter> <lbarasti> Congrats on the 0.32 release 🎉 ⏎ On a different note... What do you call a Crystal programmer? `Crystaller`?
<FromGitter> <bcardiff> @Blacksmoke16 thanks
<FromGitter> <dscottboggs_gitlab> > What do you call a Crystal programmer? ⏎ ⏎ A programmer. One who happens to write Crystal. I never got this, like I write Crystal and Python and BASH and C and maybe combine all of the above and others and, while crystal is my favorite I never got the whole *rustacean*/*gopher* thing
<FromGitter> <dscottboggs_gitlab> sorry idk that came off kinda agressive I didn't mean it that way
<FromGitter> <lbarasti> no no, I get what you mean @dscottboggs_gitlab
<FromGitter> <lbarasti> I kind of like the idea of having being a `Rubyist`, though
<FromGitter> <lbarasti> it's just something that stays with you, no matter what you end up doing next or day to day
<FromGitter> <dscottboggs_gitlab> idk. I might feel that way if I felt I'd find the "perfect" language but I don't feel like I have, or that perhaps that's not attainable
<FromGitter> <lbarasti> hey, maybe I'm just too sentimental 😅
<FromGitter> <dscottboggs_gitlab> hah! maybe I'm just too picky!