forked from openfab-lab/app-membres
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): Adds a way to display content from GitHub to the website
It allows to have some pages that will mirror content stored on openfab's repository cf openfab-lab#22 (cherry picked from commit 86e903d)
- Loading branch information
Showing
5 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const mdMirror = require('md-mirror') | ||
|
||
module.exports = (req, res) => { | ||
|
||
const mm = new mdMirror({ | ||
baseLocalUrl: '/md', | ||
baseRemoteUrl: 'https://raw.githubusercontent.com/openfab-lab', | ||
viewManager: (content) => { | ||
// While caching is not available set pages to be cached 24h | ||
res.setHeader('Cache-Control', 'public, max-age=' + (60*60*24)); | ||
res.render('../src/views/md.ejs', { | ||
content, | ||
user: req.user | ||
}) | ||
} | ||
}) | ||
|
||
return mm.render(req.url) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<%- include('./layout/top', {page: 'membre'}); %> | ||
<!-- IFRAME TRICK --> | ||
<!-- | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="embed-responsive embed-responsive-16by9"> | ||
<iframe class="embed-responsive-item" srcdoc="<html> | ||
<head><%= '<link rel="stylesheet" href="https://unpkg.com/sakura.css/css/sakura.css" type="text/css">' %></head> | ||
<body><%= content %></body> | ||
</html>"></iframe> | ||
</div> | ||
</div> | ||
</div> | ||
--> | ||
|
||
<div class="container mdcontent mt-5"> | ||
<style>.mdcontent img { | ||
max-width: 100% | ||
}</style> | ||
<div class="row"> | ||
<div class="col-12"> | ||
<%- content %> | ||
</div> | ||
</div> | ||
</div> | ||
<%- include('./layout/bottom'); %> |