@blaasvaer/frmwrk 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/connections.js +3 -3
- package/controllers.js +1 -1
- package/handle-request.js +11 -8
- package/models.js +1 -1
- package/package.json +1 -1
- package/views.js +6 -0
package/connections.js
CHANGED
|
@@ -14,12 +14,12 @@ function installconnections ( config ) {
|
|
|
14
14
|
const connection_files = [];
|
|
15
15
|
|
|
16
16
|
files.forEach( file => {
|
|
17
|
-
let connection_name = file.split('.')[0];
|
|
18
|
-
|
|
19
17
|
// Skip file if name start with an underscore
|
|
20
|
-
if ( file.charAt(0) === '_' )
|
|
18
|
+
if ( file.charAt(0) === '_' || file === '.DS_Store' )
|
|
21
19
|
return;
|
|
22
20
|
|
|
21
|
+
let connection_name = file.split('.')[0];
|
|
22
|
+
|
|
23
23
|
let promise = new Promise( function ( resolve, reject ) {
|
|
24
24
|
|
|
25
25
|
let connection = require( connections_dir + file );
|
package/controllers.js
CHANGED
|
@@ -13,7 +13,7 @@ function installControllers ( config ) {
|
|
|
13
13
|
|
|
14
14
|
files.forEach( file => {
|
|
15
15
|
// Skip file if name start with an underscore
|
|
16
|
-
if ( file.charAt(0) === '_' )
|
|
16
|
+
if ( file.charAt(0) === '_' || file === '.DS_Store' )
|
|
17
17
|
return;
|
|
18
18
|
|
|
19
19
|
let promise = new Promise( function( resolve, reject ) {
|
package/handle-request.js
CHANGED
|
@@ -51,12 +51,12 @@ async function handleRequest( req, res ) {
|
|
|
51
51
|
*/
|
|
52
52
|
if (request_url.pathname === '/service-worker.js') {
|
|
53
53
|
// TODO: Set theme dynamically
|
|
54
|
-
var
|
|
54
|
+
var worker = path.join('', 'service-worker.js');
|
|
55
55
|
res.statusCode = 200;
|
|
56
56
|
res.setHeader('Content-Type', 'text/javascript');
|
|
57
57
|
|
|
58
|
-
if ( fs.existsSync(
|
|
59
|
-
fs.createReadStream(
|
|
58
|
+
if ( fs.existsSync( worker ) ) {
|
|
59
|
+
fs.createReadStream( worker ).pipe( res );
|
|
60
60
|
return;
|
|
61
61
|
} else {
|
|
62
62
|
return;
|
|
@@ -81,6 +81,13 @@ async function handleRequest( req, res ) {
|
|
|
81
81
|
|
|
82
82
|
let response_output = 'Nothing here …';
|
|
83
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Set Content Type
|
|
86
|
+
*/
|
|
87
|
+
if ( controller?.route?.params?.type ) {
|
|
88
|
+
content_type = controller?.route?.params?.type;
|
|
89
|
+
}
|
|
90
|
+
|
|
84
91
|
switch ( method ) {
|
|
85
92
|
case 'GET':
|
|
86
93
|
if ( ! controller.route.params?.authorize ) {
|
|
@@ -110,10 +117,6 @@ async function handleRequest( req, res ) {
|
|
|
110
117
|
// route.params.redirect.call();
|
|
111
118
|
// response_output = 'Access denied';
|
|
112
119
|
}
|
|
113
|
-
|
|
114
|
-
if ( controller.route.params.type ) {
|
|
115
|
-
content_type = controller.route.params.type;
|
|
116
|
-
}
|
|
117
120
|
}
|
|
118
121
|
|
|
119
122
|
res.statusCode = status_code;
|
|
@@ -145,7 +148,7 @@ async function handleRequest( req, res ) {
|
|
|
145
148
|
res.setHeader( 'Content-Type', content_types[content_type] );
|
|
146
149
|
|
|
147
150
|
// Cookies
|
|
148
|
-
res.setHeader( 'Set-Cookie','uuid=1234-1324-1234-1234-1234; Max-Age=3000; SameSite=lax; Secure' );
|
|
151
|
+
// res.setHeader( 'Set-Cookie','uuid=1234-1324-1234-1234-1234; Max-Age=3000; SameSite=lax; Secure' );
|
|
149
152
|
res.setHeader( 'Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, DELETE, OPTIONS' );
|
|
150
153
|
// res.setHeader( 'Content-Security-Policy', "default-src 'self'; img-src 'self';");
|
|
151
154
|
|
package/models.js
CHANGED
|
@@ -13,7 +13,7 @@ function installModels ( config ) {
|
|
|
13
13
|
|
|
14
14
|
files.forEach( file => {
|
|
15
15
|
// Skip file if name start with an underscore
|
|
16
|
-
if ( file.charAt(0) === '_' )
|
|
16
|
+
if ( file.charAt(0) === '_' || file === '.DS_Store' )
|
|
17
17
|
return;
|
|
18
18
|
|
|
19
19
|
let promise = new Promise( function ( resolve, reject ) {
|
package/package.json
CHANGED
package/views.js
CHANGED
|
@@ -36,6 +36,12 @@ function Views ( config ) {
|
|
|
36
36
|
.isFile()
|
|
37
37
|
? readFile( path )
|
|
38
38
|
.then(function ( template ) {
|
|
39
|
+
// Prevent .DS_Store files from breaking templates
|
|
40
|
+
let ds_store_file_path = path.split('/');
|
|
41
|
+
|
|
42
|
+
if ( ds_store_file_path[ ds_store_file_path.length - 1 ] === '.DS_Store' )
|
|
43
|
+
return;
|
|
44
|
+
|
|
39
45
|
let tpl = 'Handlebars.template(' + Handlebars.precompile( template.toString() ) + ')';
|
|
40
46
|
|
|
41
47
|
if ( config.compress_html ) {
|