-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save to Netlify #264
Comments
going to move our convo here since it's related but more specific! i'm still not able to reproduce the error! can you give me more specific steps or conditions about your sandbox? |
#141 (comment) love how little you're going to use to get this task done! |
hm. ok so i tried it on Wikipedia again and now the visbug edited text shows up in the outerHTML dump. not sure what went wrong in my initial try. i can work with this. now to see how to send it to the netlify api.. and maybe add a button to visbug to do this |
looks like we basically need to POST to const anonymousUpload = files =>
withApi((dispatch, getState, api) =>
api
.dropToken() // https://api.netlify.com/api/v1/drop/token
.then(response => response.data.token)
.then(token =>
api
.dropFiles(getDigest(files), token) // https://api.netlify.com/api/v1/drop
.then(response => ({ token, deploy: response.data }))
)
.then(({ token, deploy }) =>
uploadDeployFiles(api, deploy, files, token)
.then(() => api.waitForSiteDeploy(deploy.subdomain))
.then(response => ({ token, site: response.data }))
)
.then(({ site, token }) => {
setToken(token);
dispatch(siteActions.siteSuccess(site));
dispatch(loadScreenshot(site.name));
dispatch(push(`/drop/${site.name}`));
})
);
|
no bandwidth to do this now just leaving notes for myself |
netlify's open api swagger can be seen here: https://github.com/netlify/open-api https://open-api.netlify.com/#/default |
this upload to netlify feature is begging to be a plugin 😉 visbug will call the "netlify" plugin function if/when the user types "/netlify" into the search bar, invoking this feature with the DOM, ready for pushing to netlify! could even open a new tab for them with the url loaded, ready to review and share. 💥 any change I can rekindle this flame and help ya push the feature in??!! |
100% lets do it! i’ll try to make a standalone demo of how to upload files to netlify without using the netlify ui without authentication. once i have that, we can lean on your visbug knowledge to connect the dots. |
branch with a netlify plugin added https://github.com/GoogleChromeLabs/ProjectVisBug/tree/netlify-plugin |
i investigated this today, and it seems like we really jealously guard that |
what's the flow for getting a token? |
ok so i'm avoiding using that visbug account option first - i checked with someone on the backend team, and it turns out the endpoint was just a little opaque - it required a valid I can mock that Referer field in Node, which is what I am doing now, but I'm not sure how we will go about this when inside VisBug. I assume that we will be able to solve this eventually, so I'm just proceeding for now to make a stripped down demo of the rest of the flow. Step 2: the next step after getting the token is to so once we have the "digest", and the token, we can POST to fetch("https://api.netlify.com/api/v1/drop", {
method: "POST",
body: JSON.stringify({
files: digest,
token
})
}); Step 3: we get back a reference to a "deploy" and use the Netlify js client to upload (internal ref) Once this is done, its downhill from there. we get back a reference to the Gonna pause on this today and pick it back up on some later date if we have access to a node execution environment, we can use the Netlify CLI which makes this whole thing a lot easier: https://docs.google.com/document/d/1ACEYkiLiKwW6QEcZA7E9TMs9ju7xpo1WIErgEDxs3SE/edit |
sounds like a cloud function + a secret could make this all much less painful?.. |
you don't fetch the referrer, you set the a cloud function + secret might work - would VisBug be able to chuck its data over to the cloud function? i'm not sure what underlying data structure VisBug uses |
VisBug works on the DOM 😉 we could totally setup a cloud function that owns a secret, question is, do i want to own and maintain it. even though it's serverless, doesnt mean it'll be free from hack attempts and abuse.. |
ok, no problem, we'll do it the first way then, should be stateless and cost nothing. just saw your comments on the original issue: #141 (comment) how exactly will you serialize the diff? and is visbug set up to replay those diffs? because that would make things much easier... but im guessing you dont have any of this functionality yet right |
if visbug chooses the serialize/deserialize route, there's a few ways to attack it. and yep, in another branch i'm hacking on a pub/sub visbug api (which includes a serialization of changes) so other tools can either receive the changes visbug made, or visbug can consume them from an external caller and apply them. it's an interesting problem, lots of ways to solve it, not enough time to pick any lol. |
i am trying to make a "Save to Netlify" feature but am a bit lost about how to hack this together. i edit using visbug and the dom changes in the dev tools, but when i run
document.documentElement.outerHTML
ordocument.body.innerHTML
i still see the old (original) DOM printed out. is there somewhere i can just "download" all the post edited HTML/CSS?thanks
Shawn
Originally posted by @sw-yx in #141 (comment)
The text was updated successfully, but these errors were encountered: