MrCrackPotBuilde

Activity Graph

Page 1 of 9 | Next »

2019-06-18

[02:47:08] MrCrackPotBuilde: Ping timeout: 252 seconds
[04:46:32] MrCrackPotBuilde: has joined #RubyOnRails
[07:04:11] MrCrackPotBuilde: Ping timeout: 250 seconds
[09:15:12] MrCrackPotBuilde: has joined #RubyOnRails
[15:40:43] MrCrackPotBuilde: Ping timeout: 248 seconds

2019-06-17

[01:52:10] MrCrackPotBuilde: has joined #RubyOnRails
[03:18:45] MrCrackPotBuilde: Remote host closed the connection
[03:21:17] MrCrackPotBuilde: has joined #RubyOnRails

2019-06-16

[23:53:04] MrCrackPotBuilde: Ping timeout: 252 seconds

2019-06-15

[17:37:59] MrCrackPotBuilde: you could create your own method
[17:38:05] MrCrackPotBuilde: which sounds like you should
[17:38:25] MrCrackPotBuilde: take a look at rails active storage direct upload s3
[17:38:50] MrCrackPotBuilde: this does some funky magic i dont understand
[17:39:11] MrCrackPotBuilde: but somehow bypasses the app but gives you url etc for db
[17:39:49] MrCrackPotBuilde: it doesnt like json at all
[17:39:56] MrCrackPotBuilde: fdshkfjhdkjcnklsj'sajdklsjadkjsncdkhfasd
[17:40:31] MrCrackPotBuilde: well with json request you cant send a file
[17:40:45] MrCrackPotBuilde: you have to send text which leaves ONLY base64
[17:41:05] MrCrackPotBuilde: does sall the magic
[17:41:23] MrCrackPotBuilde: and trying to figure out how to by pass with the params is nigh on impossible
[17:41:47] MrCrackPotBuilde: its a pain and seems pointless
[17:42:05] MrCrackPotBuilde: i have to encode it all my self anyway so why use active storage
[17:42:21] MrCrackPotBuilde: to use active storage with json request
[17:42:27] MrCrackPotBuilde: not a multi form request
[17:42:36] MrCrackPotBuilde: and you cant do both together
[17:43:08] MrCrackPotBuilde: yes but then you have absalutely no need to use active storage at all
[17:43:18] MrCrackPotBuilde: what if you need both api and web
[17:43:34] MrCrackPotBuilde: how do you upload files for a user then
[17:43:55] MrCrackPotBuilde: im doing what we arre speaking about right now myself
[17:44:37] MrCrackPotBuilde: you cant create a user with json fields and upload a file with multi form
[17:45:37] MrCrackPotBuilde: copy paste that into web browser
[17:45:49] MrCrackPotBuilde: as long as its the data
[17:46:07] MrCrackPotBuilde: well active storage isnt expecting a base64
[17:46:20] MrCrackPotBuilde: its expecting something completely different somewhere else
[17:46:43] MrCrackPotBuilde: https://evilmartians.com/chronicles/rails-5-2-active-storage-and-beyond
[17:46:56] MrCrackPotBuilde: its expecting a request like that
[17:47:24] MrCrackPotBuilde: but its getting avatar: "data:image/png blah blah blah super long :
[17:47:43] MrCrackPotBuilde: yes but then you dont need active storage
[17:48:06] MrCrackPotBuilde: active storage takes that js temp file stores it in cloud or server etc not db
[17:48:16] MrCrackPotBuilde: it gives you a public url to use instead
[17:48:45] MrCrackPotBuilde: yes but then you have to really play around with the params
[17:49:28] MrCrackPotBuilde: right but with json i have to do all that manuall
[17:49:45] MrCrackPotBuilde: which makes active storage pointless
[17:50:05] MrCrackPotBuilde: it does what its suppose to with html sites
[17:50:15] MrCrackPotBuilde: and if you only upload an image
[17:50:32] MrCrackPotBuilde: that is outside of the default json route of the api
[17:51:00] MrCrackPotBuilde: but if you want one request to create a user and upload a file
[17:51:10] MrCrackPotBuilde: that becomes a lot more challenging with active storage
[17:51:49] MrCrackPotBuilde: but whats the point if active storage does that again
[17:51:59] MrCrackPotBuilde: its doing what i did again
[17:52:05] MrCrackPotBuilde: but just to put it in the server
[17:52:22] MrCrackPotBuilde: direct upload is supposed to do some magic to help
[17:52:25] MrCrackPotBuilde: but im too dumb for that
[17:52:37] MrCrackPotBuilde: but that adds up
[17:52:54] MrCrackPotBuilde: because the resources drain is not on the server
[17:52:57] MrCrackPotBuilde: its on the client
[17:53:02] MrCrackPotBuilde: my way its on both
[17:54:01] MrCrackPotBuilde: there is no form
[17:54:11] MrCrackPotBuilde: as the request comes from a completely different language
[17:54:22] MrCrackPotBuilde: 3 different languages
[17:54:53] MrCrackPotBuilde: ios android mac win linux
[17:55:02] MrCrackPotBuilde: its multi platform
[17:55:52] MrCrackPotBuilde: so the request isnt a multi form from android or ios
[17:56:19] MrCrackPotBuilde: all requests are json and im not willing to sacrifice a second call just for an image
[17:56:42] MrCrackPotBuilde: multi form and json is completely different
[17:57:00] MrCrackPotBuilde: and from things like postman you cant send json and multiform
[17:57:16] MrCrackPotBuilde: you create a multi form for json and multi form for image
[17:57:24] MrCrackPotBuilde: parse both and then do the magic
[17:57:50] MrCrackPotBuilde: but then you need more resources because you have to create that json file
[17:58:02] MrCrackPotBuilde: not just store it in memory shortly
[17:59:01] MrCrackPotBuilde: you would send one then straight away send the other
[17:59:28] MrCrackPotBuilde: but your routes would need to allow for any method that uses multi form to allow that as well as json
[18:00:06] MrCrackPotBuilde: otherwise if you just default to json when you send the multi form data itll come back with an error
[18:00:10] MrCrackPotBuilde: or mine does any way
[18:01:58] MrCrackPotBuilde: active storage looks like it only accepts multi form data
[18:02:45] MrCrackPotBuilde: the whole point of active storage from what i see is just to encode decode images store them not in the db but on a server and then link the files
[18:03:19] MrCrackPotBuilde: so a normal html post request cant do multi form and json toether
[18:03:25] MrCrackPotBuilde: or i cant because im too dumb
[18:03:39] MrCrackPotBuilde: so you need to make two requests
[18:03:51] MrCrackPotBuilde: becayse a user must have an image
[18:04:00] MrCrackPotBuilde: cant go forward without it
[18:04:25] MrCrackPotBuilde: this perticular app has 5 files to upload
[18:04:40] MrCrackPotBuilde: and they must all be present no exceptions
[18:05:23] MrCrackPotBuilde: i use network requests in various languages that end up as a json request
[18:05:30] MrCrackPotBuilde: has to be this way
[18:05:36] MrCrackPotBuilde: far too much data
[18:06:32] MrCrackPotBuilde: html request in json format
[18:06:44] MrCrackPotBuilde: as its a rails api
[18:06:51] MrCrackPotBuilde: thats how it wants them
[18:07:48] MrCrackPotBuilde: but if you have a lot of users and they make 6 individual requests to the server
[18:07:51] MrCrackPotBuilde: that costs a lot
[18:08:15] MrCrackPotBuilde: so it needs to be one request that the server then handles
[18:08:29] MrCrackPotBuilde: keeps things sweet and simple
[18:09:06] MrCrackPotBuilde: json or multiform not both
[18:09:19] MrCrackPotBuilde: but you can create a json request using a file
[18:09:39] MrCrackPotBuilde: but again thats a lot of effor of parsing the file and the image
[18:09:50] MrCrackPotBuilde: so the only option is to encode it
[18:09:58] MrCrackPotBuilde: store it and link it
[18:11:01] MrCrackPotBuilde: a promising option is to use the active storage direct upload
[18:11:07] MrCrackPotBuilde: see how that is handled
[18:11:42] MrCrackPotBuilde: then try to grab those credentials and store them in my db but then you have authentication issues
[18:12:05] MrCrackPotBuilde: i dont know how rails active storage gets around the file upload to the server without storing credentials in my application
[18:12:17] MrCrackPotBuilde: which im not doing
[18:13:14] MrCrackPotBuilde: sorry paramters of the image
[18:13:55] MrCrackPotBuilde: but the credentials shouldnt be stored in the db or on the application
[18:14:20] MrCrackPotBuilde: if you get those you could download every image from the s3 or cloud server account
[18:14:33] MrCrackPotBuilde: you need to auth to upload a file to a server
[18:14:54] MrCrackPotBuilde: you dont want public access to a server storing your shiz
[18:16:06] MrCrackPotBuilde: reguardless dev or not
[18:16:19] MrCrackPotBuilde: encryption is a must requirement
[18:16:27] MrCrackPotBuilde: no server can be public
[18:16:54] MrCrackPotBuilde: in heroku they are encypted
[18:17:31] MrCrackPotBuilde: but this is only my credentials
[18:18:06] MrCrackPotBuilde: but you dont store plain text creds in a application
[18:18:32] MrCrackPotBuilde: you miss my point
[18:19:02] MrCrackPotBuilde: if i upload my credentails to heroku its fine
[18:19:16] MrCrackPotBuilde: i can upload images to s3 cliod etc
[18:19:48] MrCrackPotBuilde: when you use direct upload it does some weird magic where it bypasses lets say heroku
[18:19:54] MrCrackPotBuilde: and goes direct to s3
[18:20:03] MrCrackPotBuilde: now in a web server env
[18:20:19] MrCrackPotBuilde: creds go in credentials all enc and what not
[18:20:29] MrCrackPotBuilde: you put the amster key in jeroku and your good
[18:20:50] MrCrackPotBuilde: direct upload reduces load on your server
[18:20:56] MrCrackPotBuilde: like ive said previously
[18:21:02] MrCrackPotBuilde: every reqest costs money
[18:21:09] MrCrackPotBuilde: why send an image to heroku then s3
[18:21:33] MrCrackPotBuilde: you store the image in s3 and your link the image in your db
[18:21:46] MrCrackPotBuilde: thats what active storage paperclop and carrierwave did for you
[18:22:32] MrCrackPotBuilde: you dont put creds in applications
[18:22:47] MrCrackPotBuilde: and deffinately not this application
[18:23:31] MrCrackPotBuilde: but my app does not
[18:24:03] MrCrackPotBuilde: lol i should probably mention an hour in to this that im not working on one app
[18:24:12] MrCrackPotBuilde: app is mobile comp and api is rails
[18:24:51] MrCrackPotBuilde: becayse active storage is mainly for html
[18:24:56] MrCrackPotBuilde: it doesnt work in api mode
[18:24:59] MrCrackPotBuilde: from what i can tell
[18:26:38] MrCrackPotBuilde: where do i store them
[18:27:11] MrCrackPotBuilde: if i bypass heroku using direct upload then i have to have creds in the app not the api
[18:28:11] MrCrackPotBuilde: so yer really i dont need active storage at all and in turn is pretty useless with api's best to stick with base64
[18:28:30] MrCrackPotBuilde: lol i think im going to bed
[18:28:42] MrCrackPotBuilde: i say that i dont leave
[18:29:13] MrCrackPotBuilde: i live in singapore
[18:29:38] MrCrackPotBuilde: your thinking local dude
[18:30:04] MrCrackPotBuilde: yes but direct uploads bypass this
[18:30:17] MrCrackPotBuilde: which means you need to have them on the app itself so the device
[18:30:48] MrCrackPotBuilde: thats an extra requset
[18:32:07] MrCrackPotBuilde: i just deleted 4 days of work
[18:32:14] MrCrackPotBuilde: so yer it helped
[18:32:25] MrCrackPotBuilde: it helped a lot in my own understanding
[18:32:53] MrCrackPotBuilde: i have come to the tired conclusion that active storage and rails api its a waste of time
[18:33:24] MrCrackPotBuilde: but there is no else where
[18:34:10] MrCrackPotBuilde: but im not sure how active storage direct upload gets those credentials
[18:34:16] MrCrackPotBuilde: i need more digging
[18:34:24] MrCrackPotBuilde: but for now im not going ot put that in prod
[18:34:29] MrCrackPotBuilde: keep it as a branch
[18:35:55] MrCrackPotBuilde: right but lets say im a hacker i could make a request to the server to get the creds to upload a file
[18:36:12] MrCrackPotBuilde: disect the response and then steal the creds to get all the images or files
[18:36:47] MrCrackPotBuilde: this is why i need to know exactly how it makes a response
[18:37:44] MrCrackPotBuilde: yer but if direct uploaduses aws sdk to then the request to the user would give them the creds to upload the file
[18:38:44] MrCrackPotBuilde: sorry its dam early
[18:38:51] MrCrackPotBuilde: im so high and tired
[18:39:06] MrCrackPotBuilde: ok you siad user makes a request to get the credentials right
[18:39:11] MrCrackPotBuilde: for direct upload
[18:39:30] MrCrackPotBuilde: so those creds need to be sent back to the user to use
[18:40:14] MrCrackPotBuilde: yes but with direct upload it bypasses your server
[18:40:34] MrCrackPotBuilde: it doesnt go to the server it goes direct to the cloud or other storage server
[18:40:50] MrCrackPotBuilde: so for this you need creds
[18:41:29] MrCrackPotBuilde: yes so if direct upload first sends a request to your server to get the creds its then going to use those to get to the upload server
[18:42:12] MrCrackPotBuilde: so the signed url is not user pass its a key created
[18:42:25] MrCrackPotBuilde: right now i get it
[18:42:42] MrCrackPotBuilde: its using pub priv key based encyption basically
[18:43:29] MrCrackPotBuilde: now that makes much more sense
[18:43:48] MrCrackPotBuilde: duleja this was my worry
[18:43:54] MrCrackPotBuilde: that it didnt do thi
[18:44:05] MrCrackPotBuilde: then its bad very very bad
[18:44:25] MrCrackPotBuilde: but i still need to solve the json issue next
[18:44:54] MrCrackPotBuilde: yer thats where ive been stearing towards tonight
[18:45:04] MrCrackPotBuilde: it makes more sense
[18:45:19] MrCrackPotBuilde: 100000 users a day
[18:46:36] MrCrackPotBuilde: if i can upload then just use a url and image name in the db that is much more efficent cost effective
[18:47:46] MrCrackPotBuilde: on this note though i reakky am now off. shansen thank you for the clarification it helps a lot
[18:48:00] MrCrackPotBuilde: duleja nice chatting
[18:50:04] MrCrackPotBuilde: once you get them there great