Skip to content

Commit

Permalink
Fixing demo site
Browse files Browse the repository at this point in the history
  • Loading branch information
karllhughes committed Oct 5, 2019
1 parent d3a9514 commit e84e390
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 101 deletions.
10 changes: 2 additions & 8 deletions docs/_includes/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@ <h3 class="font-600">About</h3>
source, so we decided to release RSS-To-Email as a freemium tool.
</p>
<p class="text-muted">
The product is still in development, but feedback and bug reports are welcome. If you'd like to be one of
the first to get premium access to new features, sign up below to be notified when it's ready.
The product is still in development, but feedback and bug reports are welcome!
</p>
</div>
<div class="text-center">
<button type="button" data-toggle="modal" data-target="#CenterModal"
class="modal-activator btn btn-success waves-effect waves-light m-t-10"
data-feature="about">
Request Premium Access
</button>
<a class="btn btn-primary m-t-10" href="{{ site.github }}/issues">Report an Issue</a>
<a class="btn btn-primary m-t-10" href="{{ site.github }}/issues">Report an Issue on Github</a>
</div>
</div><!-- end col -->
</div>
8 changes: 4 additions & 4 deletions docs/_includes/email_preview.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ <h1 class="text-center d-md-none mb-5 mt-5"><i class="ti-arrow-circle-up"></i></
</div>
<div class="tab-pane fade" id="mjml-b1">
<h1 class="text-center mb-5 mt-5"><i class="ion-locked"></i></h1>
<p class="text-center text-muted">This feature is only available to premium users.</p>
<p class="text-center text-muted">This feature is coming soon!</p>
<p class="text-center mb-5">
<button type="button" class="modal-activator btn btn-success waves-effect waves-light" data-toggle="modal" data-target="#CenterModal" data-feature="mjml-output">Request Premium Access</button>
<a class="btn btn-info waves-effect waves-light" href="https://github.com/portable-cto/rss-to-email">Contribute on Github</a>
</p>
</div>
<div class="tab-pane fade" id="api-b1">
<h1 class="text-center mb-5 mt-5"><i class="ion-locked"></i></h1>
<p class="text-center text-muted">This feature is only available to premium users.</p>
<p class="text-center text-muted">This feature is coming soon!</p>
<p class="text-center mb-5">
<button type="button" class="modal-activator btn btn-success waves-effect waves-light" data-toggle="modal" data-target="#CenterModal" data-feature="api-access">Request Premium Access</button>
<a class="btn btn-info waves-effect waves-light" href="https://github.com/portable-cto/rss-to-email">Contribute on Github</a>
</p>
</div>
</div>
Expand Down
2 changes: 0 additions & 2 deletions docs/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
</footer>
<!-- End Footer -->

{% include modal.html %}

<!-- jQuery -->
<script src="/assets/js/jquery.min.js"></script>
<script src="/assets/js/popper.min.js"></script><!-- Popper for Bootstrap --><!-- Tether for Bootstrap -->
Expand Down
58 changes: 0 additions & 58 deletions docs/_includes/modal.html

This file was deleted.

19 changes: 5 additions & 14 deletions docs/_includes/options_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ <h4 class="m-t-0 header-title">Options</h4>
</div>
<div class="col-sm-8">
<p class="text-muted small">
Multiple feeds only available to premium users.
<a href="#" class="modal-activator"
data-feature="multiple-feeds" data-toggle="modal"
data-target="#CenterModal">Request premium access</a>.
Multiple feeds is coming soon!
<a href="https://github.com/portable-cto/rss-to-email">Contribute on Github</a>.
</p>
</div>
</div>
Expand Down Expand Up @@ -79,18 +77,11 @@ <h4 class="m-t-0 header-title">Styling</h4>
</div>
<div class="form-group row">
<label class="col-3 col-form-label">
<i class="ion-locked"></i> Template URL
Template URL
</label>
<div class="col-9">
<input disabled type="url" class="form-control"
placeholder="https://raw.githubusercontent.com/portable-cto/rss-to-email/master/src/templates/default.mjml">
<p class="mt-1 text-muted small">
Custom templates only available to premium users.
<a href="#premium" data-toggle="modal"
class="modal-activator" data-feature="custom-templates"
data-target="#CenterModal">Request premium
access</a>.
</p>
<input type="url" class="form-control" name="templateUrl"
value="https://raw.githubusercontent.com/portable-cto/rss-to-email/master/src/templates/default.mjml">
</div>
</div>

Expand Down
1 change: 1 addition & 0 deletions docs/assets/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ $('form#email-options').submit(function () {
data : JSON.stringify(data),
dataType: 'html',
contentType : 'application/json',
crossDomain: true,
type : 'POST',
success: function (response) {
$('#preview-b1').html(response);
Expand Down
42 changes: 27 additions & 15 deletions functions/rss-to-email/index.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,33 @@
const RssToEmail = require('rss-to-email');

module.exports = (request, response) => {
const config = request.body || {};
const rssToEmail = RssToEmail(config);
const headers = {};
headers['Access-Control-Allow-Origin'] = '*';
headers['Access-Control-Allow-Methods'] = 'POST, GET, PUT, DELETE, OPTIONS';
headers['Access-Control-Allow-Headers'] = 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept';

rssToEmail.getEmail(config.format || 'html')
.then(email => {
response.writeHead(200, {
'Content-Type': 'text/html ',
});
response.end(email);
})
.catch(e => {
console.error(e);
response.writeHead(500, {
'Content-Type': 'text/html ',
if (request.method === 'OPTIONS') {
response.writeHead(204, headers);
response.end();
} else {
const config = request.body || {};
const rssToEmail = RssToEmail(config);

rssToEmail.getEmail(config.format || 'html')
.then(email => {
response.writeHead(200, {
...headers,
'Content-Type': 'text/html ',
});
response.end(email);
})
.catch(e => {
console.error(e);
response.writeHead(500, {
...headers,
'Content-Type': 'text/html ',
});
response.end('Something went wrong. Please check the server logs for more info.')
});
response.end('Something went wrong. Please check the server logs for more info.')
});
}
};

0 comments on commit e84e390

Please sign in to comment.