-
Notifications
You must be signed in to change notification settings - Fork 303
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
Implement #81 Sync Script.about with Github webhook #440
Conversation
Using a js file allows us to add comments, and grab environment variables.
+ Script.syncAboutSourceUrl + Script.syncAbout Script.updated defaults to Date.now()
Only validate request ips in production so we can test locally. Webhook will now return 4xx status codes if something goes wrong. Seperate github importing logic from the controller. Move several controllers to their own file. Moved /user/* routes to /account/* Add github webhook test. Broke /account/github/import
Conflicts: controllers/user.js routes.js views/includes/userToolsPanel.html
Provide 3 text areas to represent the Repo/User/path.to.md Fix Typo: githubImporter.importJavasciptBlob => githubImporter.importJavascriptBlob Fix missed settings => config
express-minify requires node-sass which build on Heroku (isPro || isDev) == (isPro || !isPro) == true
+1 on moving settings to
EDIT: |
All fields are case sensitive. Which probably should be insensitive since the user might type it out. |
However, the file path might have to stay case sensitive since https://github.com/jerone/UserScripts/blob/master/PDF_Tools/README.md = 200 |
@Zren commented on 23 nov. 2014 12:09 CET:
Case sensitive it is. The edit description page might benefit from a message saying that every changes done to the description on OUJS will be overridden when the hooked readme file changes. I might be even better to disable the description field when sync is enabled. |
Tempted to hook the 'change' event and show a checkmark/red X when we get a 200/404 with: $.ajax({type:'HEAD',url:'https://cdn.rawgit.com/jerone/UserScripts/master/PDF_Tools/README.md'}).done(function(data, textStatus, res){console.log(res.status)}).fail(function(res, textStatus, errorThrown){console.log(res.status)}); Of course, we'd have to use rawgit.com for to get around the crossdomain issue. EditDon't think I'll use it unless we get a proper 404 testing service. Might instead create a clickable link below the text fields to manually test. var inputs = $('input[name="githubSyncUserId"], input[name="githubSyncRepoName"], input[name="githubSyncAboutPath"]');
inputs.on('change', function() {
var githubSyncUserId = $('input[name="githubSyncUserId"]');
var githubSyncRepoName = $('input[name="githubSyncRepoName"]');
var githubSyncAboutPath = $('input[name="githubSyncAboutPath"]');
if (githubSyncUserId && githubSyncRepoName && githubSyncAboutPath) {
githubSyncUserId = githubSyncUserId.val();
githubSyncRepoName = githubSyncRepoName.val();
githubSyncAboutPath = githubSyncAboutPath.val();
var url = 'https://cdn.rawgit.com/' + githubSyncUserId + '/' + githubSyncRepoName + '/master/' + githubSyncAboutPath;
$.ajax({
type:'HEAD',
url: url
}).done(function(data, textStatus, res) {console.log(res.status);
$('#sync-about-info').removeClass('alert-info alert-success alert-danger').addClass('alert-success');
}).fail(function(res, textStatus, errorThrown) {console.log(res.status);
$('#sync-about-info').removeClass('alert-info alert-success alert-danger').addClass('alert-danger');
});
}
}); |
@Zren commented on 23 nov. 2014 12:36 CET:
The problem with http://rawgit.com is that it doesn't guarantee the best uptime. If implemented it would be a none dependable feature, only shown when I correctly returns an usable result, not prohibiting any other actions. |
You both are going to love this (sarcasm) Impossible to vote on a PR that has more than what is issued at #81 so -1 and marking as invalid and assigning a milestone so that @Zren can fix his machine....... and closing. :( aka 😦 As I have stated before we need some of these... make separate issues for items not specific to syncing the *.md ... I am open to separate PRs... @jerone when I said cherry picking for yours that's revoked because @Zren is abusing it here whether intentional or not.
You are wise. :) |
So if I break this up into 8 seperate PRs, you'll merge them all? All the code is ready to be evaluated, so might as well do it here. |
No because #441 exists for you... I created it so we can work on that... I need to know why this is happening and how we can fix it... I went through a similar process with nodejitsu with the git urls. |
There's also a potential block from sizzle on your |
The only reason for the optionalDependency change is so I don't have to mange a second branch for heroku. I can take it out for the merge. Simple enough.
The whole point it to make it a
if having 3 ~8 line files is your thing. |
The whole point is that my |
Reread my posts with any corrections... this is what happens with sleep deprivation when I'm installing a specific distro that took 30 minutes but compile time took 5 retries because I'm unfamiliar with Ubuntu and resulted in 3 hours loss of sleep since that test machine is sooooooo slow.... and I can't comment any more right now ... we'll resume after I rest. |
A different language that allows abstracting env variables project wide with a bit of logic ala
See
Um... what? There's no change to the env variable names that would need you to change nodejitsu settings. |
Now that #441 has been concluded. I'll remove the So the only things that need to be changed are:
While renaming And all the other commits are actually relevant to the PR. Anything else besides:
? |
Since the holidays are just around the corner here... off "hold" for everything will probably start sometime next week... not this week. The queue is just about maxed out right now for this upcoming week (don't know about jerones pr but when he comes back from respite to finish that off most likely that should get in this week)... take a break and perhaps reread things especially since I don't care about the filename of |
See: #81
Test
https://nameless-hollows-5487.herokuapp.com
Use
http://nameless-hollows-5487.herokuapp.com/github/hook
for your webhook.Summary
Refactored the entire github hook, and parts of github import.
Webhooks now return a status code on error, and return a
[err, jsFileList, mdFileList]
response on success. Eg:Moved both controllers to their own files in a pattern I plan to expand to other controllers.
Refactor
/model/settings.json
into/config.js
which allows us to attach comments, parse env vars and provide defaults for them, and centralize all app variables.Rename
/user/*
routes to/account/*
.Move express-minify to optionalDependencies. Do not minify when isDbg.
Screenshots