File tree 5 files changed +45
-21
lines changed
5 files changed +45
-21
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ packages:
11
11
- lib
12
12
13
13
entries :
14
- client/fontello
14
+ - client/fontello
15
+ - server/fontello
15
16
16
17
lib :
17
18
entries :
Original file line number Diff line number Diff line change
1
+ recursive : true
2
+ public : false
3
+ type :
4
+ widget_i18n : i18n/*.yml
5
+ widget_view : " *.jade"
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ // Handles requests for font generation
2
+ //
3
+ 'use strict' ;
4
+
5
+
6
+ const _ = require ( 'lodash' ) ;
7
+ const validator = require ( 'is-my-json-valid' ) ;
8
+ const config_schema = require ( '../_lib/config_schema' ) ;
9
+
10
+
11
+ module . exports = function ( N , apiPath ) {
12
+ const cfg_check = validator ( config_schema , { verbose : true } ) ;
13
+
14
+ // Disable validation here to customize error message
15
+ N . validate ( apiPath , { additionalProperties : true , properties : { } } ) ;
16
+
17
+
18
+ N . wire . before ( apiPath , function validate ( env ) {
19
+ if ( cfg_check ( env . params ) ) return ;
20
+
21
+ let message = [ env . t ( 'err_cfg_validation' ) ] . concat ( _ . map (
22
+ cfg_check . errors ,
23
+ e => `- ${ e . field } ${ e . message } `
24
+ ) ) . join ( '\n' ) ;
25
+
26
+ throw { code : N . io . CLIENT_ERROR , message } ;
27
+ } ) ;
28
+
29
+
30
+ N . wire . on ( apiPath , function * request_font_generation ( env ) {
31
+ let params = { config : env . params } ;
32
+
33
+ yield N . wire . emit ( 'internal:fontello.font_build' , params ) ;
34
+ env . res . id = params . fontId ;
35
+ } ) ;
36
+ } ;
Original file line number Diff line number Diff line change
1
+ en-US :
2
+ err_cfg_validation : " Config validation error: "
You can’t perform that action at this time.
0 commit comments