Skip to content

Instantly share code, notes, and snippets.

View ArnaudBuchholz's full-sized avatar
🏠
Working from home

Arnaud Buchholz ArnaudBuchholz

🏠
Working from home
View GitHub Profile
module.exports = async function (request, response, ui5Path) {
const { referer } = request.headers
const version = (/\bversion\b=(\d+\.\d+\.\d+)/.exec(referer) || [0, '1.76.0'])[1]
response.writeHead(302, {
Location: `https://openui5.hana.ondemand.com/${version}/resources/${ui5Path}`
})
response.end()
}
{
"port": 8080,
"mappings": [{
"match": "/resources/(.*)",
"headers": {
"Location": "https://openui5.hana.ondemand.com/1.76.0/resources/$1"
},
"status": 302
}, {
"custom": "./csp.js"
module.exports = async function (request, response) {
response.setHeader('Content-Security-Policy', 'default-src \'self\'')
}
{
"port": 8080,
"mappings": [{
"match": "/resources/(.*)",
"url": "https://openui5.hana.ondemand.com/1.76.0/resources/$1"
}, {
"custom": "./csp.js"
}, {
"match": "^/(\\?.*)?$",
"file": "./webapp/index.html"
{
"port": 8080,
"mappings": [{
"match": "/@openui5/([^/]*)/(.*)",
"url": "https://openui5.hana.ondemand.com/$1/resources/$2"
}, {
"match": "/resources/(.*)",
"custom": "./proxy-version.js"
}, {
"custom": "./csp.js"
module.exports = async function (request, response, ui5Path) {
const { referer } = request.headers
const version = (/\bversion\b=(\d+\.\d+\.\d+)/.exec(referer) || [0, '1.76.0'])[1]
response.writeHead(302, {
Location: `/@openui5/${version}/${ui5Path}`
})
response.end()
}
{
"mappings": [{
"match": "^/proxy/(https?)/(.*)",
"url": "$1://$2",
"unsecure-cookies": true
}, {
"match": "^/echo/(.*)$",
"custom": "./echo.js"
}, {
"match": "^/chrome/(.*)$",
{
"extend": "./mappings.json",
"port": 5000
}
let caseSensitive = true
function getEntry (entryPath) {
if (!caseSensitive) {
entryPath = entryPath.toLowerCase()
}
if (entryPath === '/') {
return entries
}
return entryPath.split(path.sep).slice(1).reduce((folder, name) => {
const gpf = require("gpf-js");
class A {
constructor () {
this._a = "A";
}
}
const B = gpf.define({
$class: "B",