Skip to content

Commit

Permalink
Merge pull request #225 from examind-ai/sprightly
Browse files Browse the repository at this point in the history
Use sprightly for html generation
  • Loading branch information
Cvmcosta committed Jun 17, 2024
2 parents 05d16ea + ba7bd96 commit 2f17902
Show file tree
Hide file tree
Showing 8 changed files with 456 additions and 18 deletions.
23 changes: 23 additions & 0 deletions copy-html-files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const fs = require('fs')
const path = require('path')

const srcDir = path.resolve(__dirname, 'src')
const distDir = path.resolve(__dirname, 'dist')

const copyHtmlFiles = (src, dest) => {
fs.readdirSync(src).forEach((file) => {
const srcFile = path.join(src, file)
const destFile = path.join(dest, file)

if (fs.lstatSync(srcFile).isDirectory()) {
if (!fs.existsSync(destFile)) {
fs.mkdirSync(destFile)
}
copyHtmlFiles(srcFile, destFile)
} else if (path.extname(srcFile) === '.html') {
fs.copyFileSync(srcFile, destFile)
}
})
}

copyHtmlFiles(srcDir, distDir)
10 changes: 9 additions & 1 deletion dist/Provider/Services/DeepLinking.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h

const jwt = require('jsonwebtoken');
const provDeepLinkingDebug = require('debug')('provider:deepLinkingService');
const path = require('path');
const {
sprightly
} = require('sprightly');
const deepLinkSubmissionForm = path.join(__dirname, '../../Templates', 'DeepLinkSubmissionForm.html');
var _getPlatform = /*#__PURE__*/new WeakMap();
var _ENCRYPTIONKEY = /*#__PURE__*/new WeakMap();
var _Database = /*#__PURE__*/new WeakMap();
Expand Down Expand Up @@ -36,7 +41,10 @@ class DeepLinking {
const message = await this.createDeepLinkingMessage(idtoken, contentItems, options);

// Creating auto submitting form
const form = '<form id="ltijs_submit" style="display: none;" action="' + idtoken.platformContext.deepLinkingSettings.deep_link_return_url + '" method="POST">' + '<input type="hidden" name="JWT" value="' + message + '" />' + '</form>' + '<script>' + 'document.getElementById("ltijs_submit").submit()' + '</script>';
const form = sprightly(deepLinkSubmissionForm, {
action: idtoken.platformContext.deepLinkingSettings.deep_link_return_url,
message
});
return form;
}

Expand Down
6 changes: 6 additions & 0 deletions dist/Templates/DeepLinkSubmissionForm.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<form id="ltijs_submit" style="display: none;" action="{{action}}" method="POST">
<input type="hidden" name="JWT" value="{{message}}" />
</form>
<script>
document.getElementById("ltijs_submit").submit()
</script>
Loading

0 comments on commit 2f17902

Please sign in to comment.