I'm designing my new Ember CLI application. I gonna use Ember Simple Auth for authorisation. And I also need to use CSRF protection. I know how to inject the token to requests. The problem is how to embed the token to the application in a right way.
It is required the token to be generated on the backend side and to be embedded into the page. And it should be the same one that API uses to verify requests.
In my case API and Ember application would be served by the same web server (most likely Microsoft IIS, since API is build with .NET MVC). So the web server should generate the token and embed it somehow into the Ember application once its index file requested.
But Ember CLI generates static index.html file during its build process. And I see just two ways of embedding the token.
The first one is to parse Ember's index.html file on each request and embed CSRF token metatag to the proper place. I don't really like this way.
The second one is to make Ember CLI produce index.aspx instead of index.html during the build process. In this case web server would put the token automatically. I like this way better, but i'm not sure if it's possible. And if it is then how to do this?
Maybe, there is another better way? Any help and advices would be appreciated.
It is possible to implement your second idea. You need to specify options.outputPaths.app.html property of EmberApp in ember-cli-build.js:
const app = new EmberApp({
outputPaths: {
app: {
html: 'index.aspx'
}
}
});
Doing this will result in Ember CLI writing index.aspx instead of index.html to filesystem:
You can read more about configuring output paths of your Ember CLI application in user-guide.
You can also dig directly in Ember CLI's ember-app.js source code to see if you can adjust options more to your needs.
Is it possible to make it environment-dependent? It works perfectly
for production build. But it doesn't work for development since Ember
CLI can not serve .aspx files. So it would be nice to overwrite output
files for production builds only and use generic ones for development
and test environments.
You can achieve this by checking value of app.env. So, in ember-cli-build.js, instead of passing outputPaths as argument, use following technique:
const app = new EmberApp();
if (app.env === 'production') {
app.options.outputPaths.app.html = 'index.aspx';
}
This way you still get index.aspx in dist/ when building for production, but development and test environments' outputPaths options are untouched and live development/testing works.
Related
I'm trying to write a script that quickly checks if our Jenkins plugins are up to date. I know that this is a built in feature in Jenkins, but for security reasons, our Jenkins instance doesn't have internet access.
I know that I can get a lot of information about a plugin, including version, from:
https://plugins.jenkins.io/<name-of-plugin>
However, I can't get it to return anything other than HTML. I could scrape the HTML for the version number, but if there is a stable API that returns JSON or similar, that would be preferred. I'm pretty sure Jenkins isn't scraping HTML to check for updates, so the API must exist. Does anyone know where it is?
There seem to be two solutions available. I ended up scraping:
https://updates.jenkins.io/download/plugins/<name-of-plugin>
The latest version is always in the second column of the second row, so scraping is trivial. It works well most of the time, but sometimes the connection is refused, which I assume might be due to of the volume of requests sent by the script.
Another option that I found is to download the following JSON file:
https://updates.jenkins.io/current/update-center.actual.json
It is currently 1.7MB and contains information about the latest version of all Jenkins plugins. It also contains meta data like dependencies, which allows your script to validate that all dependencies are satisfied.
Unfortunately I haven't found a way to download JSON for individual plugins, so you either have to scrape HTML for individual plugins or download a massive JSON for all plugins.
Update: I found the API:
https://plugins.jenkins.io/api/plugin/<name-of-plugin>
And I also found the source code and the documentation:
https://github.com/jenkins-infra/plugin-site-api
I used to use buildbot eight before, where i was able to access my html artifacts generated by tests by just using URL:
<server>:<port>/path_to_resource,
where path to resource was in <preifx>/master/public_html.
I can't access it in buildbot 0.9.10 as I get resource not found.
I wonder if there is an option what would allow me to access my html files from a browser?
This feature was removed in 0.9.0.
An issue asks for the implementation of a plugin implementing this feature. It is still open currently with no assignee.
I have not found any other solution. I would be very interested if a solution was found.
I have a landing page (some.html) pointing to bundle.js . Under the chrome debugger I do see all my files getting loaded properly but still I get errors in the code like 'this' is undefined etc .
Please note :
I don't have node / npm / webpack installed
I am not running webpack-dev-server running on this server
What is the proper way to deploy / refer a bundle.js file ?
Do I need to install webpack globally on this server ?
I need to know is it possible to just get the functionality of my SPA through a bundle.js being pointed from index.html provided that bundle.js was generated using a webpack on my dev-machine ?
Seems like yes through an index.html we can point to a bundled js if all the functionality is client side and we can get the desired functionality. My reactApp was broken because it the underlying the page (old application) was supporting prototype.js and therefore react's internal functions had issues. Once I removed reference to prototype - my application is working in that old container –
The new Facebook AccountKit, looks like a great way to add passwordless authentication to a mobile app.
Parse Server is fast becoming a de-facto choice for mobile back-ends.
Is adding AccountKit support underway somewhere with Parse Server? If so where? Where should I look or ask? (Yes, I've tried!)
Any suggestions for how to get started? E.g. is it possible to add to the existing oauth support in Parse Server?
Just trying to make sure that this doesn't exist somewhere obvious already and/or that efforts aren't underway before I jump in... (or, possibly, that this is just a dumb idea and that's why I can't find it!)
Sorry for being late
Yes its possible you can use a new parse server module called "parse-server-accountkit-auth"
In the parse-server-example folder run
npm install -S parse-server-accountkit-auth
This will make install this module in node_modules folder. Don't change anything in the module.
Edit the index.js file in parse-server-example and configure ParseServer with oauth, you can find this in parse server docs
Then use this code where you are defining your data (e.g in your index.js of parse-server-example)
oauth: {
accountkit: {
module: 'parse-server-accountkit-auth',
appSecret: 'YOUR_APP_SECRET'
},},
Hope this helps.
I'm using CassiniDevLib to host an MVC app for integration testing.
In order to do it I need to amend some config settings on the web server so they match the integration testing environment, first one being the connection string so it points to the test database.
I know I can have two copies of the web.config file and rename them but I was wondering if there was a more elegant way. ie a way to amend the settings in code as part of the Test Fixture setup. The challenge being that I need to access the web server process from my test ficture process
Would appreciate any thoughts on this.
I assume that you are using Visual Studio 2010. In that, you have a feature called as Config Transforms. Basically you can have multiple config file for each build environment. You can have your own custom build env. You have a new one by going to Configuration Manager and adding a new one.
http://blogs.msdn.com/b/webdevtools/archive/2009/05/04/web-deployment-web-config-transformation.aspx
you can search on the internet for Config Transforms, if you need more examples.