Showing
22 changed files
with
974 additions
and
69 deletions
... | @@ -12,6 +12,9 @@ var lpgRouter = require('./routes/lpg') | ... | @@ -12,6 +12,9 @@ var lpgRouter = require('./routes/lpg') |
12 | var weatherRouter = require('./routes/weather') | 12 | var weatherRouter = require('./routes/weather') |
13 | var menuRouter = require('./routes/menu') | 13 | var menuRouter = require('./routes/menu') |
14 | var csvRouter = require('./routes/csv') | 14 | var csvRouter = require('./routes/csv') |
15 | +var postRouter = require('./routes/post') | ||
16 | +var postaddRouter = require('./routes/postadd') | ||
17 | + | ||
15 | var app = express(); | 18 | var app = express(); |
16 | var router = express.Router(); | 19 | var router = express.Router(); |
17 | 20 | ||
... | @@ -49,6 +52,8 @@ app.use('/login',loginRouter); // login page route | ... | @@ -49,6 +52,8 @@ app.use('/login',loginRouter); // login page route |
49 | app.use('/weather',weatherRouter) | 52 | app.use('/weather',weatherRouter) |
50 | app.use('/lpg',lpgRouter) | 53 | app.use('/lpg',lpgRouter) |
51 | app.use('/signup',signupRouter); // sign up page route | 54 | app.use('/signup',signupRouter); // sign up page route |
55 | +app.use('/post',postRouter); | ||
56 | +app.use('/postadd',postaddRouter); | ||
52 | app.use('/', indexRouter); // main page route | 57 | app.use('/', indexRouter); // main page route |
53 | 58 | ||
54 | 59 | ... | ... |
... | @@ -2,6 +2,8 @@ module.exports = { | ... | @@ -2,6 +2,8 @@ module.exports = { |
2 | server_port: 3000, | 2 | server_port: 3000, |
3 | db_url: 'mongodb://oss:12341234@cluster0.us5lm.mongodb.net/?retryWrites=true&w=majority', | 3 | db_url: 'mongodb://oss:12341234@cluster0.us5lm.mongodb.net/?retryWrites=true&w=majority', |
4 | db_schemas: [ | 4 | db_schemas: [ |
5 | - {file:'./user_schema', collection:'users3', schemaName:'UserSchema', modelName:'UserModel'} | 5 | + {file:'./user_schema', collection:'users', schemaName:'UserSchema', modelName:'UserModel'}, |
6 | + {file:'./post_schema.js', collection:'post', schemaName:'PostSchema', modelName:'PostModel'} | ||
6 | ] | 7 | ] |
8 | + | ||
7 | } | 9 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -4,16 +4,12 @@ var db_url = 'mongodb+srv://oss:12341234@cluster0.us5lm.mongodb.net/?retryWrites | ... | @@ -4,16 +4,12 @@ var db_url = 'mongodb+srv://oss:12341234@cluster0.us5lm.mongodb.net/?retryWrites |
4 | var database = {}; | 4 | var database = {}; |
5 | 5 | ||
6 | // 초기화를 위해 호출하는 함수 | 6 | // 초기화를 위해 호출하는 함수 |
7 | -database.init = function(app, config) { | 7 | +database.init = function(app, config) { |
8 | - console.log('init() 호출됨.'); | ||
9 | - | ||
10 | connect(app, config); | 8 | connect(app, config); |
11 | } | 9 | } |
12 | 10 | ||
13 | //데이터베이스에 연결하고 응답 객체의 속성으로 db 객체 추가 | 11 | //데이터베이스에 연결하고 응답 객체의 속성으로 db 객체 추가 |
14 | -function connect(app, config) { | 12 | +function connect(app, config) { |
15 | - console.log('connect() 호출됨.'); | ||
16 | - | ||
17 | // 데이터베이스 연결 : config의 설정 사용 | 13 | // 데이터베이스 연결 : config의 설정 사용 |
18 | mongoose.Promise = global.Promise; // mongoose의 Promise 객체는 global의 Promise 객체 사용하도록 함 | 14 | mongoose.Promise = global.Promise; // mongoose의 Promise 객체는 global의 Promise 객체 사용하도록 함 |
19 | mongoose.connect(db_url); | 15 | mongoose.connect(db_url); |
... | @@ -35,27 +31,22 @@ function connect(app, config) { | ... | @@ -35,27 +31,22 @@ function connect(app, config) { |
35 | // config에 정의된 스키마 및 모델 객체 생성 | 31 | // config에 정의된 스키마 및 모델 객체 생성 |
36 | function createSchema(app, config) { | 32 | function createSchema(app, config) { |
37 | var schemaLen = config.db_schemas.length; | 33 | var schemaLen = config.db_schemas.length; |
38 | - console.log('설정에 정의된 스키마의 수 : %d', schemaLen); | ||
39 | 34 | ||
40 | for (var i = 0; i < schemaLen; i++) { | 35 | for (var i = 0; i < schemaLen; i++) { |
41 | var curItem = config.db_schemas[i]; | 36 | var curItem = config.db_schemas[i]; |
42 | 37 | ||
43 | // 모듈 파일에서 모듈 불러온 후 createSchema() 함수 호출하기 | 38 | // 모듈 파일에서 모듈 불러온 후 createSchema() 함수 호출하기 |
44 | var curSchema = require(curItem.file).createSchema(mongoose); | 39 | var curSchema = require(curItem.file).createSchema(mongoose); |
45 | - console.log('%s 모듈을 불러들인 후 스키마 정의함.', curItem.file); | ||
46 | 40 | ||
47 | // User 모델 정의 | 41 | // User 모델 정의 |
48 | var curModel = mongoose.model(curItem.collection, curSchema); | 42 | var curModel = mongoose.model(curItem.collection, curSchema); |
49 | - console.log('%s 컬렉션을 위해 모델 정의함.', curItem.collection); | ||
50 | 43 | ||
51 | // database 객체에 속성으로 추가 | 44 | // database 객체에 속성으로 추가 |
52 | database[curItem.schemaName] = curSchema; | 45 | database[curItem.schemaName] = curSchema; |
53 | database[curItem.modelName] = curModel; | 46 | database[curItem.modelName] = curModel; |
54 | - console.log('스키마 이름 [%s], 모델 이름 [%s] 이 database 객체의 속성으로 추가됨.', curItem.schemaName, curItem.modelName); | ||
55 | } | 47 | } |
56 | 48 | ||
57 | app.set('database', database); | 49 | app.set('database', database); |
58 | - console.log('database 객체가 app 객체의 속성으로 추가됨.'); | ||
59 | } | 50 | } |
60 | 51 | ||
61 | 52 | ... | ... |
app/database/post_schema.js
0 → 100644
1 | +var SchemaObj = {}; | ||
2 | + | ||
3 | + SchemaObj.createSchema = function(mongoose) { | ||
4 | + | ||
5 | + // 글 스키마 정의 | ||
6 | + var PostSchema = mongoose.Schema({ | ||
7 | + title: {type: String, trim: true, 'default':''}, // 글 제목 | ||
8 | + contents: {type: String, trim:true, 'default':''}, // 글 내용 | ||
9 | + writer: {type: mongoose.Schema.ObjectId, ref: 'users'}, // 글쓴 사람 | ||
10 | + comments: [{ // 댓글 | ||
11 | + contents: {type: String, trim:true, 'default': ''}, // 댓글 내용 | ||
12 | + writer: {type: mongoose.Schema.ObjectId, ref: 'users'}, | ||
13 | + created_at: {type: Date, 'default': Date.now} | ||
14 | + }], | ||
15 | + tags: {type: [], 'default': ''}, | ||
16 | + created_at: {type: Date, index: {unique: false}, 'default': Date.now}, | ||
17 | + updated_at: {type: Date, index: {unique: false}, 'default': Date.now} | ||
18 | + }); | ||
19 | + | ||
20 | + // 필수 속성에 대한 'required' validation | ||
21 | + PostSchema.path('title').required(true, '글 제목을 입력하셔야 합니다.'); | ||
22 | + PostSchema.path('contents').required(true, '글 내용을 입력하셔야 합니다.'); | ||
23 | + | ||
24 | + // 스키마에 인스턴스 메소드 추가 | ||
25 | + PostSchema.methods = { | ||
26 | + savePost: function(callback) { // 글 저장 | ||
27 | + var self = this; | ||
28 | + | ||
29 | + this.validate(function(err) { | ||
30 | + if (err) return callback(err); | ||
31 | + | ||
32 | + self.save(callback); | ||
33 | + }); | ||
34 | + }, | ||
35 | + addComment: function(user, comment, callback) { // 댓글 추가 | ||
36 | + this.comment.push({ | ||
37 | + contents: comment.contents, | ||
38 | + writer: user._id | ||
39 | + }); | ||
40 | + | ||
41 | + this.save(callback); | ||
42 | + }, | ||
43 | + removeComment: function(id, callback) { // 댓글 삭제 | ||
44 | + var index = utils.indexOf(this.comments, {id: id}); | ||
45 | + if (~index) { | ||
46 | + this.comments.splice(index, 1); | ||
47 | + } else { | ||
48 | + return callback('ID [' + id + '] 를 가진 댓글 객체를 찾을 수 없습니다.'); | ||
49 | + } | ||
50 | + | ||
51 | + this.save(callback); | ||
52 | + } | ||
53 | + } | ||
54 | + | ||
55 | + PostSchema.statics = { | ||
56 | + // ID로 글 찾기 | ||
57 | + load: function(id, callback) { | ||
58 | + this.findOne({_id: id}) | ||
59 | + .populate('writer', 'name provider email') | ||
60 | + .populate('comments.writer') | ||
61 | + .exec(callback); | ||
62 | + }, | ||
63 | + list: function(options, callback) { | ||
64 | + var criteria = options.criteria || {}; | ||
65 | + | ||
66 | + this.find(criteria) | ||
67 | + .populate('writer', 'name provider email') | ||
68 | + .sort({'created_at': -1}) | ||
69 | + .limit(Number(options.perPage)) | ||
70 | + .skip(options.perPage * options.page) | ||
71 | + .exec(callback); | ||
72 | + } | ||
73 | + } | ||
74 | + | ||
75 | + return PostSchema; | ||
76 | + }; | ||
77 | + | ||
78 | + // module.exports에 PostSchema 객체 직접 할당 | ||
79 | + module.exports = SchemaObj; | ||
80 | + | ||
81 | + | ||
82 | + /** | ||
83 | + * 배열 객체 안의 배열 요소가 가지는 인덱스 값 리턴 | ||
84 | + */ | ||
85 | +function indexOf(arr, obj) { | ||
86 | + var index = -1; | ||
87 | + var keys = Object.keys(obj); | ||
88 | + | ||
89 | + var result = arr.filter(function (doc, idx) { | ||
90 | + var matched = 0; | ||
91 | + | ||
92 | + for (var i = keys.length - 1; i >= 0; i--) { | ||
93 | + if (doc[keys[i]] === obj[keys[i]]) { | ||
94 | + matched++; | ||
95 | + | ||
96 | + if (matched === keys.length) { | ||
97 | + index = idx; | ||
98 | + return idx; | ||
99 | + } | ||
100 | + } | ||
101 | + } | ||
102 | + }); | ||
103 | + | ||
104 | + return index; | ||
105 | +} | ||
106 | + | ||
107 | +/** | ||
108 | + * 배열 안의 요소 중에서 파라미터와 같은 객체를 리턴 | ||
109 | + */ | ||
110 | +function findByParam(arr, obj, callback) { | ||
111 | + var index = exports.indexof(arr, obj) | ||
112 | + if (~index && typeof callback === 'function') { | ||
113 | + return callback(undefined, arr[index]) | ||
114 | + } else if (~index && !callback) { | ||
115 | + return arr[index] | ||
116 | + } else if (!~index && typeof callback === 'function') { | ||
117 | + return callback('not found') | ||
118 | + } | ||
119 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -10,7 +10,7 @@ Schema.createSchema = function(mongoose) { | ... | @@ -10,7 +10,7 @@ Schema.createSchema = function(mongoose) { |
10 | hashed_password: {type: String, required: true, 'default':''}, | 10 | hashed_password: {type: String, required: true, 'default':''}, |
11 | salt: {type:String, required:true}, | 11 | salt: {type:String, required:true}, |
12 | name: {type: String, index: 'hashed', 'default':''}, | 12 | name: {type: String, index: 'hashed', 'default':''}, |
13 | - age: {type: Number, 'default': -1}, | 13 | + email: {type: Number, 'default': ''}, |
14 | created_at: {type: Date, index: {unique: false}, 'default': Date.now}, | 14 | created_at: {type: Date, index: {unique: false}, 'default': Date.now}, |
15 | updated_at: {type: Date, index: {unique: false}, 'default': Date.now} | 15 | updated_at: {type: Date, index: {unique: false}, 'default': Date.now} |
16 | }); | 16 | }); |
... | @@ -91,8 +91,6 @@ Schema.createSchema = function(mongoose) { | ... | @@ -91,8 +91,6 @@ Schema.createSchema = function(mongoose) { |
91 | return this.find({}, callback); | 91 | return this.find({}, callback); |
92 | }); | 92 | }); |
93 | 93 | ||
94 | - console.log('UserSchema 정의함.'); | ||
95 | - | ||
96 | return UserSchema; | 94 | return UserSchema; |
97 | }; | 95 | }; |
98 | 96 | ... | ... |
app/routes/post.js
0 → 100644
1 | + | ||
2 | +var express = require('express') | ||
3 | +var router = express.Router() | ||
4 | +var Entities = require('html-entities').AllHtmlEntities; | ||
5 | + | ||
6 | +router.get('/',function(req,res){ | ||
7 | + var paramPage = 0; | ||
8 | + var paramPerPage = 10; | ||
9 | + | ||
10 | + var database = req.app.get('database'); | ||
11 | + | ||
12 | + // 데이터베이스 객체가 초기화된 경우 | ||
13 | + if (database.db) { | ||
14 | + // 1. 글 리스트 | ||
15 | + var options = { | ||
16 | + page: paramPage, | ||
17 | + perPage: paramPerPage | ||
18 | + } | ||
19 | + | ||
20 | + database.PostModel.list(options, function(err, results) { | ||
21 | + if (err) { | ||
22 | + console.error('게시판 글 목록 조회 중 에러 발생 : ' + err.stack); | ||
23 | + | ||
24 | + res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
25 | + res.write('<h2>게시판 글 목록 조회 중 에러 발생</h2>'); | ||
26 | + res.write('<p>' + err.stack + '</p>'); | ||
27 | + res.end(); | ||
28 | + | ||
29 | + return; | ||
30 | + } | ||
31 | + | ||
32 | + if (results) { | ||
33 | + console.dir(results); | ||
34 | + | ||
35 | + // 전체 문서 객체 수 확인 | ||
36 | + database.PostModel.count().exec(function(err, count) { | ||
37 | + | ||
38 | + res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
39 | + | ||
40 | + // 뷰 템플레이트를 이용하여 렌더링한 후 전송 | ||
41 | + var context = { | ||
42 | + title: '글 목록', | ||
43 | + posts: results, | ||
44 | + page: parseInt(paramPage), | ||
45 | + pageCount: Math.ceil(count / paramPerPage), | ||
46 | + perPage: paramPerPage, | ||
47 | + totalRecords: count, | ||
48 | + size: paramPerPage | ||
49 | + }; | ||
50 | + req.app.render('post', context, function(err, html) { | ||
51 | + if (err) { | ||
52 | + console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
53 | + | ||
54 | + res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
55 | + res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
56 | + res.write('<p>' + err.stack + '</p>'); | ||
57 | + res.end(); | ||
58 | + | ||
59 | + return; | ||
60 | + } | ||
61 | + | ||
62 | + res.end(html); | ||
63 | + }); | ||
64 | + | ||
65 | + }); | ||
66 | + | ||
67 | + } else { | ||
68 | + res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
69 | + res.write('<h2>글 목록 조회 실패</h2>'); | ||
70 | + res.end(); | ||
71 | + } | ||
72 | + }); | ||
73 | + } else { | ||
74 | + res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
75 | + res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
76 | + res.end(); | ||
77 | + } | ||
78 | + | ||
79 | +}) | ||
80 | + | ||
81 | +module.exports = router; | ||
82 | +// var addpost = function(req, res) { | ||
83 | +// console.log('post 모듈 안에 있는 addpost 호출됨.'); | ||
84 | + | ||
85 | +// var paramTitle = req.body.title || req.query.title; | ||
86 | +// var paramContents = req.body.contents || req.query.contents; | ||
87 | +// var paramWriter = req.body.writer || req.query.writer; | ||
88 | + | ||
89 | +// console.log('요청 파라미터 : ' + paramTitle + ', ' + paramContents + ', ' + | ||
90 | +// paramWriter); | ||
91 | + | ||
92 | +// var database = req.app.get('database'); | ||
93 | + | ||
94 | +// // 데이터베이스 객체가 초기화된 경우 | ||
95 | +// if (database.db) { | ||
96 | + | ||
97 | +// // 1. 아이디를 이용해 사용자 검색 | ||
98 | +// database.UserModel.findByEmail(paramWriter, function(err, results) { | ||
99 | +// if (err) { | ||
100 | +// console.error('게시판 글 추가 중 에러 발생 : ' + err.stack); | ||
101 | + | ||
102 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
103 | +// res.write('<h2>게시판 글 추가 중 에러 발생</h2>'); | ||
104 | +// res.write('<p>' + err.stack + '</p>'); | ||
105 | +// res.end(); | ||
106 | + | ||
107 | +// return; | ||
108 | +// } | ||
109 | + | ||
110 | +// if (results == undefined || results.length < 1) { | ||
111 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
112 | +// res.write('<h2>사용자 [' + paramWriter + ']를 찾을 수 없습니다.</h2>'); | ||
113 | +// res.end(); | ||
114 | + | ||
115 | +// return; | ||
116 | +// } | ||
117 | + | ||
118 | +// var userObjectId = results[0]._doc._id; | ||
119 | +// console.log('사용자 ObjectId : ' + paramWriter +' -> ' + userObjectId); | ||
120 | + | ||
121 | +// // save()로 저장 | ||
122 | +// // PostModel 인스턴스 생성 | ||
123 | +// var post = new database.PostModel({ | ||
124 | +// title: paramTitle, | ||
125 | +// contents: paramContents, | ||
126 | +// writer: userObjectId | ||
127 | +// }); | ||
128 | + | ||
129 | +// post.savePost(function(err, result) { | ||
130 | +// if (err) { | ||
131 | +// if (err) { | ||
132 | +// console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
133 | + | ||
134 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
135 | +// res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
136 | +// res.write('<p>' + err.stack + '</p>'); | ||
137 | +// res.end(); | ||
138 | + | ||
139 | +// return; | ||
140 | +// } | ||
141 | +// } | ||
142 | + | ||
143 | +// console.log("글 데이터 추가함."); | ||
144 | +// console.log('글 작성', '포스팅 글을 생성했습니다. : ' + post._id); | ||
145 | + | ||
146 | +// return res.redirect('/process/showpost/' + post._id); | ||
147 | +// }); | ||
148 | + | ||
149 | +// }); | ||
150 | + | ||
151 | +// } else { | ||
152 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
153 | +// res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
154 | +// res.end(); | ||
155 | +// } | ||
156 | + | ||
157 | +// }; | ||
158 | + | ||
159 | +// var listpost = function(req, res) { | ||
160 | +// console.log('post 모듈 안에 있는 listpost 호출됨.'); | ||
161 | + | ||
162 | +// var paramPage = req.body.page || req.query.page; | ||
163 | +// var paramPerPage = req.body.perPage || req.query.perPage; | ||
164 | + | ||
165 | +// console.log('요청 파라미터 : ' + paramPage + ', ' + paramPerPage); | ||
166 | + | ||
167 | +// var database = req.app.get('database'); | ||
168 | + | ||
169 | +// // 데이터베이스 객체가 초기화된 경우 | ||
170 | +// if (database.db) { | ||
171 | +// // 1. 글 리스트 | ||
172 | +// var options = { | ||
173 | +// page: paramPage, | ||
174 | +// perPage: paramPerPage | ||
175 | +// } | ||
176 | + | ||
177 | +// database.PostModel.list(options, function(err, results) { | ||
178 | +// if (err) { | ||
179 | +// console.error('게시판 글 목록 조회 중 에러 발생 : ' + err.stack); | ||
180 | + | ||
181 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
182 | +// res.write('<h2>게시판 글 목록 조회 중 에러 발생</h2>'); | ||
183 | +// res.write('<p>' + err.stack + '</p>'); | ||
184 | +// res.end(); | ||
185 | + | ||
186 | +// return; | ||
187 | +// } | ||
188 | + | ||
189 | +// if (results) { | ||
190 | +// console.dir(results); | ||
191 | + | ||
192 | +// // 전체 문서 객체 수 확인 | ||
193 | +// database.PostModel.count().exec(function(err, count) { | ||
194 | + | ||
195 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
196 | + | ||
197 | +// // 뷰 템플레이트를 이용하여 렌더링한 후 전송 | ||
198 | +// var context = { | ||
199 | +// title: '글 목록', | ||
200 | +// posts: results, | ||
201 | +// page: parseInt(paramPage), | ||
202 | +// pageCount: Math.ceil(count / paramPerPage), | ||
203 | +// perPage: paramPerPage, | ||
204 | +// totalRecords: count, | ||
205 | +// size: paramPerPage | ||
206 | +// }; | ||
207 | + | ||
208 | +// req.app.render('listpost', context, function(err, html) { | ||
209 | +// if (err) { | ||
210 | +// console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
211 | + | ||
212 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
213 | +// res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
214 | +// res.write('<p>' + err.stack + '</p>'); | ||
215 | +// res.end(); | ||
216 | + | ||
217 | +// return; | ||
218 | +// } | ||
219 | + | ||
220 | +// res.end(html); | ||
221 | +// }); | ||
222 | + | ||
223 | +// }); | ||
224 | + | ||
225 | +// } else { | ||
226 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
227 | +// res.write('<h2>글 목록 조회 실패</h2>'); | ||
228 | +// res.end(); | ||
229 | +// } | ||
230 | +// }); | ||
231 | +// } else { | ||
232 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
233 | +// res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
234 | +// res.end(); | ||
235 | +// } | ||
236 | + | ||
237 | +// }; | ||
238 | + | ||
239 | + | ||
240 | +// var showpost = function(req, res) { | ||
241 | +// console.log('post 모듈 안에 있는 showpost 호출됨.'); | ||
242 | + | ||
243 | +// // URL 파라미터로 전달됨 | ||
244 | +// var paramId = req.body.id || req.query.id || req.params.id; | ||
245 | + | ||
246 | +// console.log('요청 파라미터 : ' + paramId); | ||
247 | + | ||
248 | + | ||
249 | +// var database = req.app.get('database'); | ||
250 | + | ||
251 | +// // 데이터베이스 객체가 초기화된 경우 | ||
252 | +// if (database.db) { | ||
253 | +// // 1. 글 리스트 | ||
254 | +// database.PostModel.load(paramId, function(err, results) { | ||
255 | +// if (err) { | ||
256 | +// console.error('게시판 글 조회 중 에러 발생 : ' + err.stack); | ||
257 | + | ||
258 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
259 | +// res.write('<h2>게시판 글 조회 중 에러 발생</h2>'); | ||
260 | +// res.write('<p>' + err.stack + '</p>'); | ||
261 | +// res.end(); | ||
262 | + | ||
263 | +// return; | ||
264 | +// } | ||
265 | + | ||
266 | +// if (results) { | ||
267 | +// console.dir(results); | ||
268 | + | ||
269 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
270 | + | ||
271 | +// // 뷰 템플레이트를 이용하여 렌더링한 후 전송 | ||
272 | +// var context = { | ||
273 | +// title: '글 조회 ', | ||
274 | +// posts: results, | ||
275 | +// Entities: Entities | ||
276 | +// }; | ||
277 | + | ||
278 | +// req.app.render('showpost', context, function(err, html) { | ||
279 | +// if (err) { | ||
280 | +// console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
281 | + | ||
282 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
283 | +// res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
284 | +// res.write('<p>' + err.stack + '</p>'); | ||
285 | +// res.end(); | ||
286 | + | ||
287 | +// return; | ||
288 | +// } | ||
289 | + | ||
290 | +// console.log('응답 웹문서 : ' + html); | ||
291 | +// res.end(html); | ||
292 | +// }); | ||
293 | + | ||
294 | +// } else { | ||
295 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
296 | +// res.write('<h2>글 조회 실패</h2>'); | ||
297 | +// res.end(); | ||
298 | +// } | ||
299 | +// }); | ||
300 | +// } else { | ||
301 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
302 | +// res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
303 | +// res.end(); | ||
304 | +// } | ||
305 | + | ||
306 | +// }; | ||
307 | + | ||
308 | +// module.exports.listpost = listpost; | ||
309 | +// module.exports.addpost = addpost; | ||
310 | +// module.exports.showpost = showpost; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/routes/postadd.js
0 → 100644
1 | + | ||
2 | +var express = require('express') | ||
3 | +var router = express.Router() | ||
4 | +var Entities = require('html-entities').AllHtmlEntities; | ||
5 | + | ||
6 | +router.get('/',function(req,res){ | ||
7 | + res.render('postadd.ejs'); | ||
8 | +}) | ||
9 | + | ||
10 | +module.exports = router; | ||
11 | +// var addpost = function(req, res) { | ||
12 | +// console.log('post 모듈 안에 있는 addpost 호출됨.'); | ||
13 | + | ||
14 | +// var paramTitle = req.body.title || req.query.title; | ||
15 | +// var paramContents = req.body.contents || req.query.contents; | ||
16 | +// var paramWriter = req.body.writer || req.query.writer; | ||
17 | + | ||
18 | +// console.log('요청 파라미터 : ' + paramTitle + ', ' + paramContents + ', ' + | ||
19 | +// paramWriter); | ||
20 | + | ||
21 | +// var database = req.app.get('database'); | ||
22 | + | ||
23 | +// // 데이터베이스 객체가 초기화된 경우 | ||
24 | +// if (database.db) { | ||
25 | + | ||
26 | +// // 1. 아이디를 이용해 사용자 검색 | ||
27 | +// database.UserModel.findByEmail(paramWriter, function(err, results) { | ||
28 | +// if (err) { | ||
29 | +// console.error('게시판 글 추가 중 에러 발생 : ' + err.stack); | ||
30 | + | ||
31 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
32 | +// res.write('<h2>게시판 글 추가 중 에러 발생</h2>'); | ||
33 | +// res.write('<p>' + err.stack + '</p>'); | ||
34 | +// res.end(); | ||
35 | + | ||
36 | +// return; | ||
37 | +// } | ||
38 | + | ||
39 | +// if (results == undefined || results.length < 1) { | ||
40 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
41 | +// res.write('<h2>사용자 [' + paramWriter + ']를 찾을 수 없습니다.</h2>'); | ||
42 | +// res.end(); | ||
43 | + | ||
44 | +// return; | ||
45 | +// } | ||
46 | + | ||
47 | +// var userObjectId = results[0]._doc._id; | ||
48 | +// console.log('사용자 ObjectId : ' + paramWriter +' -> ' + userObjectId); | ||
49 | + | ||
50 | +// // save()로 저장 | ||
51 | +// // PostModel 인스턴스 생성 | ||
52 | +// var post = new database.PostModel({ | ||
53 | +// title: paramTitle, | ||
54 | +// contents: paramContents, | ||
55 | +// writer: userObjectId | ||
56 | +// }); | ||
57 | + | ||
58 | +// post.savePost(function(err, result) { | ||
59 | +// if (err) { | ||
60 | +// if (err) { | ||
61 | +// console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
62 | + | ||
63 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
64 | +// res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
65 | +// res.write('<p>' + err.stack + '</p>'); | ||
66 | +// res.end(); | ||
67 | + | ||
68 | +// return; | ||
69 | +// } | ||
70 | +// } | ||
71 | + | ||
72 | +// console.log("글 데이터 추가함."); | ||
73 | +// console.log('글 작성', '포스팅 글을 생성했습니다. : ' + post._id); | ||
74 | + | ||
75 | +// return res.redirect('/process/showpost/' + post._id); | ||
76 | +// }); | ||
77 | + | ||
78 | +// }); | ||
79 | + | ||
80 | +// } else { | ||
81 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
82 | +// res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
83 | +// res.end(); | ||
84 | +// } | ||
85 | + | ||
86 | +// }; | ||
87 | + | ||
88 | +// var listpost = function(req, res) { | ||
89 | +// console.log('post 모듈 안에 있는 listpost 호출됨.'); | ||
90 | + | ||
91 | +// var paramPage = req.body.page || req.query.page; | ||
92 | +// var paramPerPage = req.body.perPage || req.query.perPage; | ||
93 | + | ||
94 | +// console.log('요청 파라미터 : ' + paramPage + ', ' + paramPerPage); | ||
95 | + | ||
96 | +// var database = req.app.get('database'); | ||
97 | + | ||
98 | +// // 데이터베이스 객체가 초기화된 경우 | ||
99 | +// if (database.db) { | ||
100 | +// // 1. 글 리스트 | ||
101 | +// var options = { | ||
102 | +// page: paramPage, | ||
103 | +// perPage: paramPerPage | ||
104 | +// } | ||
105 | + | ||
106 | +// database.PostModel.list(options, function(err, results) { | ||
107 | +// if (err) { | ||
108 | +// console.error('게시판 글 목록 조회 중 에러 발생 : ' + err.stack); | ||
109 | + | ||
110 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
111 | +// res.write('<h2>게시판 글 목록 조회 중 에러 발생</h2>'); | ||
112 | +// res.write('<p>' + err.stack + '</p>'); | ||
113 | +// res.end(); | ||
114 | + | ||
115 | +// return; | ||
116 | +// } | ||
117 | + | ||
118 | +// if (results) { | ||
119 | +// console.dir(results); | ||
120 | + | ||
121 | +// // 전체 문서 객체 수 확인 | ||
122 | +// database.PostModel.count().exec(function(err, count) { | ||
123 | + | ||
124 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
125 | + | ||
126 | +// // 뷰 템플레이트를 이용하여 렌더링한 후 전송 | ||
127 | +// var context = { | ||
128 | +// title: '글 목록', | ||
129 | +// posts: results, | ||
130 | +// page: parseInt(paramPage), | ||
131 | +// pageCount: Math.ceil(count / paramPerPage), | ||
132 | +// perPage: paramPerPage, | ||
133 | +// totalRecords: count, | ||
134 | +// size: paramPerPage | ||
135 | +// }; | ||
136 | + | ||
137 | +// req.app.render('listpost', context, function(err, html) { | ||
138 | +// if (err) { | ||
139 | +// console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
140 | + | ||
141 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
142 | +// res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
143 | +// res.write('<p>' + err.stack + '</p>'); | ||
144 | +// res.end(); | ||
145 | + | ||
146 | +// return; | ||
147 | +// } | ||
148 | + | ||
149 | +// res.end(html); | ||
150 | +// }); | ||
151 | + | ||
152 | +// }); | ||
153 | + | ||
154 | +// } else { | ||
155 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
156 | +// res.write('<h2>글 목록 조회 실패</h2>'); | ||
157 | +// res.end(); | ||
158 | +// } | ||
159 | +// }); | ||
160 | +// } else { | ||
161 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
162 | +// res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
163 | +// res.end(); | ||
164 | +// } | ||
165 | + | ||
166 | +// }; | ||
167 | + | ||
168 | + | ||
169 | +// var showpost = function(req, res) { | ||
170 | +// console.log('post 모듈 안에 있는 showpost 호출됨.'); | ||
171 | + | ||
172 | +// // URL 파라미터로 전달됨 | ||
173 | +// var paramId = req.body.id || req.query.id || req.params.id; | ||
174 | + | ||
175 | +// console.log('요청 파라미터 : ' + paramId); | ||
176 | + | ||
177 | + | ||
178 | +// var database = req.app.get('database'); | ||
179 | + | ||
180 | +// // 데이터베이스 객체가 초기화된 경우 | ||
181 | +// if (database.db) { | ||
182 | +// // 1. 글 리스트 | ||
183 | +// database.PostModel.load(paramId, function(err, results) { | ||
184 | +// if (err) { | ||
185 | +// console.error('게시판 글 조회 중 에러 발생 : ' + err.stack); | ||
186 | + | ||
187 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
188 | +// res.write('<h2>게시판 글 조회 중 에러 발생</h2>'); | ||
189 | +// res.write('<p>' + err.stack + '</p>'); | ||
190 | +// res.end(); | ||
191 | + | ||
192 | +// return; | ||
193 | +// } | ||
194 | + | ||
195 | +// if (results) { | ||
196 | +// console.dir(results); | ||
197 | + | ||
198 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
199 | + | ||
200 | +// // 뷰 템플레이트를 이용하여 렌더링한 후 전송 | ||
201 | +// var context = { | ||
202 | +// title: '글 조회 ', | ||
203 | +// posts: results, | ||
204 | +// Entities: Entities | ||
205 | +// }; | ||
206 | + | ||
207 | +// req.app.render('showpost', context, function(err, html) { | ||
208 | +// if (err) { | ||
209 | +// console.error('응답 웹문서 생성 중 에러 발생 : ' + err.stack); | ||
210 | + | ||
211 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
212 | +// res.write('<h2>응답 웹문서 생성 중 에러 발생</h2>'); | ||
213 | +// res.write('<p>' + err.stack + '</p>'); | ||
214 | +// res.end(); | ||
215 | + | ||
216 | +// return; | ||
217 | +// } | ||
218 | + | ||
219 | +// console.log('응답 웹문서 : ' + html); | ||
220 | +// res.end(html); | ||
221 | +// }); | ||
222 | + | ||
223 | +// } else { | ||
224 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
225 | +// res.write('<h2>글 조회 실패</h2>'); | ||
226 | +// res.end(); | ||
227 | +// } | ||
228 | +// }); | ||
229 | +// } else { | ||
230 | +// res.writeHead('200', {'Content-Type':'text/html;charset=utf8'}); | ||
231 | +// res.write('<h2>데이터베이스 연결 실패</h2>'); | ||
232 | +// res.end(); | ||
233 | +// } | ||
234 | + | ||
235 | +// }; | ||
236 | + | ||
237 | +// module.exports.listpost = listpost; | ||
238 | +// module.exports.addpost = addpost; | ||
239 | +// module.exports.showpost = showpost; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -9,14 +9,14 @@ router.get('/',function(req,res){ | ... | @@ -9,14 +9,14 @@ router.get('/',function(req,res){ |
9 | router.post('/process', function(req, res) { | 9 | router.post('/process', function(req, res) { |
10 | console.log('/signup/process 처리함'); | 10 | console.log('/signup/process 처리함'); |
11 | 11 | ||
12 | - var paramName = req.body.name || req.query.name; | 12 | + var paramEmail = req.body.email || req.query.email; |
13 | var paramId = req.body.id || req.query.id; | 13 | var paramId = req.body.id || req.query.id; |
14 | var paramPassword = req.body.password || req.query.password; | 14 | var paramPassword = req.body.password || req.query.password; |
15 | //GET, POST 모두 고려해서 둘 다 검사 | 15 | //GET, POST 모두 고려해서 둘 다 검사 |
16 | 16 | ||
17 | res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' }); | 17 | res.writeHead('200', { 'Content-Type': 'text/html;charset=utf8' }); |
18 | res.write('<h1>Result form Express Server</h1>'); | 18 | res.write('<h1>Result form Express Server</h1>'); |
19 | - res.write('<div><p>Param name : ' + paramName + '</p></div>'); | 19 | + res.write('<div><p>Param E-mail : ' + paramEmail + '</p></div>'); |
20 | res.write('<div><p>Param id : ' + paramId + '</p></div>'); | 20 | res.write('<div><p>Param id : ' + paramId + '</p></div>'); |
21 | res.write('<div><p>Param password : ' + paramPassword + '</p></div>'); | 21 | res.write('<div><p>Param password : ' + paramPassword + '</p></div>'); |
22 | res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>"); | 22 | res.write("<br><br><a href ='/login.html'>로그인 페이지로 돌아가기</a>"); | ... | ... |
app/views/post.ejs
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="en"> | ||
3 | + | ||
4 | +<head> | ||
5 | + <meta charset="utf-8" /> | ||
6 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
7 | + <meta name="description" content="" /> | ||
8 | + <meta name="author" content="" /> | ||
9 | + <title>Modern Business - Start Bootstrap Template</title> | ||
10 | + <!-- Favicon--> | ||
11 | + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" /> | ||
12 | + <!-- Bootstrap icons--> | ||
13 | + <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" /> | ||
14 | + <!-- Core theme CSS (includes Bootstrap)--> | ||
15 | + <link href="css/styles.css" rel="stylesheet" /> | ||
16 | + <script src="http://code.jquery.com/jquery-2.1.4.js"></script> | ||
17 | +</head> | ||
18 | + | ||
19 | +<body class="d-flex flex-column h-100"> | ||
20 | + <main class="flex-shrink-0"> | ||
21 | + <!-- Navigation--> | ||
22 | + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | ||
23 | + <div class="container px-5"> | ||
24 | + <a class="navbar-brand" href="/">휴게소 정보</a> | ||
25 | + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" | ||
26 | + data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" | ||
27 | + aria-expanded="false" aria-label="Toggle navigation"><span | ||
28 | + class="navbar-toggler-icon"></span></button> | ||
29 | + <div class="collapse navbar-collapse" id="navbarSupportedContent"> | ||
30 | + <ul class="navbar-nav ms-auto mb-2 mb-lg-0"> | ||
31 | + <li class="nav-item"><a class="nav-link" href="/">Home</a></li> | ||
32 | + <li class="nav-item"><a class="nav-link" href="/menu">휴게소 메뉴</a></li> | ||
33 | + <li class="nav-item"><a class="nav-link" href="/weather">날씨</a></li> | ||
34 | + <li class="nav-item"><a class="nav-link" href="/lpg">LPG</a></li> | ||
35 | + <li class="nav-item"><a class="nav-link" href="faq.html">FAQ</a></li> | ||
36 | + <li class="nav-item dropdown"> | ||
37 | + <a class="nav-link dropdown-toggle" id="navbarDropdownBlog" href="#" role="button" | ||
38 | + data-bs-toggle="dropdown" aria-expanded="false">Blog</a> | ||
39 | + <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownBlog"> | ||
40 | + <li><a class="dropdown-item" href="blog-home.html">Blog Home</a></li> | ||
41 | + <li><a class="dropdown-item" href="blog-post.html">Blog Post</a></li> | ||
42 | + </ul> | ||
43 | + </li> | ||
44 | + <li class="nav-item dropdown"> | ||
45 | + <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" | ||
46 | + data-bs-toggle="dropdown" aria-expanded="false">Login</a> | ||
47 | + <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> | ||
48 | + <li><a class="dropdown-item" href="/login">Login</a></li> | ||
49 | + <li><a class="dropdown-item" href="/signup">Sign-up</a></li> | ||
50 | + </ul> | ||
51 | + </li> | ||
52 | + </ul> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + </nav> | ||
56 | + <!-- Page Content--> | ||
57 | + <div class="container"> | ||
58 | + <br> | ||
59 | + | ||
60 | + <div class="ui raised segment"> | ||
61 | + <a class="ui blue ribbon label">게시판</a> | ||
62 | + | ||
63 | + | ||
64 | + <div class="ui blue fluid card"> | ||
65 | + <div class="content"> | ||
66 | + <table border="1" width="800" align="center"> | ||
67 | + <tr align="center"> | ||
68 | + <p> | ||
69 | + <td colspan="3">게시판</td> | ||
70 | + </p> | ||
71 | + </tr> | ||
72 | + <tr align="center"> | ||
73 | + <td>번호</td> | ||
74 | + <td>제목</td> | ||
75 | + <td>작성자</td> | ||
76 | + <td>작성일</td> | ||
77 | + </tr> | ||
78 | + <div class="ui very relaxed selection celled list"> | ||
79 | + <% var noStart = 4; for(var i=0; i < posts.length; i++){ var curTitle=posts[i]._doc.title; | ||
80 | + var curNo=noStart - i; var createdDate = posts[i]._doc.created_at; %> | ||
81 | + <tr align="center"> | ||
82 | + <td> | ||
83 | + <%= curNo %> | ||
84 | + </td> | ||
85 | + <td> | ||
86 | + <%= curTitle %> | ||
87 | + </td> | ||
88 | + <td>admin</td> | ||
89 | + <td><%=createdDate%></td> | ||
90 | + </tr> | ||
91 | + <% } %> | ||
92 | + </div> | ||
93 | + </table> | ||
94 | + | ||
95 | + | ||
96 | + | ||
97 | + | ||
98 | + <br><br> | ||
99 | + <a class="ui button" href='/postadd'>글쓰기</a> | ||
100 | + | ||
101 | + </div> | ||
102 | + </div> | ||
103 | + </div> | ||
104 | + </div> | ||
105 | + </main> | ||
106 | + <!-- Footer--> | ||
107 | + <footer class="bg-dark py-4 mt-auto"> | ||
108 | + <div class="container px-5"> | ||
109 | + <div class="row align-items-center justify-content-between flex-column flex-sm-row"> | ||
110 | + <div class="col-auto"> | ||
111 | + <div class="small m-0 text-white">Copyright © Your Website 2022</div> | ||
112 | + </div> | ||
113 | + <div class="col-auto"> | ||
114 | + <a class="link-light small" href="#!">Privacy</a> | ||
115 | + <span class="text-white mx-1">·</span> | ||
116 | + <a class="link-light small" href="#!">Terms</a> | ||
117 | + <span class="text-white mx-1">·</span> | ||
118 | + <a class="link-light small" href="#!">Contact</a> | ||
119 | + </div> | ||
120 | + </div> | ||
121 | + </div> | ||
122 | + </footer> | ||
123 | + <!-- Bootstrap core JS--> | ||
124 | + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> | ||
125 | + <!-- Core theme JS--> | ||
126 | + <script src="js/scripts.js"></script> | ||
127 | +</body> | ||
128 | + | ||
129 | +</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
app/views/postadd.ejs
0 → 100644
1 | +<!DOCTYPE html> | ||
2 | +<html lang="en"> | ||
3 | + | ||
4 | +<head> | ||
5 | + <meta charset="utf-8" /> | ||
6 | + <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
7 | + <meta name="description" content="" /> | ||
8 | + <meta name="author" content="" /> | ||
9 | + <title>Modern Business - Start Bootstrap Template</title> | ||
10 | + <!-- Favicon--> | ||
11 | + <link rel="icon" type="image/x-icon" href="assets/favicon.ico" /> | ||
12 | + <!-- Bootstrap icons--> | ||
13 | + <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet" /> | ||
14 | + <!-- Core theme CSS (includes Bootstrap)--> | ||
15 | + <link href="css/styles.css" rel="stylesheet" /> | ||
16 | + <script src="http://code.jquery.com/jquery-2.1.4.js"></script> | ||
17 | +</head> | ||
18 | + | ||
19 | +<body class="d-flex flex-column h-100"> | ||
20 | + <main class="flex-shrink-0"> | ||
21 | + <!-- Navigation--> | ||
22 | + <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> | ||
23 | + <div class="container px-5"> | ||
24 | + <a class="navbar-brand" href="/">휴게소 정보</a> | ||
25 | + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" | ||
26 | + data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" | ||
27 | + aria-expanded="false" aria-label="Toggle navigation"><span | ||
28 | + class="navbar-toggler-icon"></span></button> | ||
29 | + <div class="collapse navbar-collapse" id="navbarSupportedContent"> | ||
30 | + <ul class="navbar-nav ms-auto mb-2 mb-lg-0"> | ||
31 | + <li class="nav-item"><a class="nav-link" href="/">Home</a></li> | ||
32 | + <li class="nav-item"><a class="nav-link" href="/menu">휴게소 메뉴</a></li> | ||
33 | + <li class="nav-item"><a class="nav-link" href="/weather">날씨</a></li> | ||
34 | + <li class="nav-item"><a class="nav-link" href="/lpg">LPG</a></li> | ||
35 | + <li class="nav-item"><a class="nav-link" href="faq.html">FAQ</a></li> | ||
36 | + <li class="nav-item dropdown"> | ||
37 | + <a class="nav-link dropdown-toggle" id="navbarDropdownBlog" href="#" role="button" | ||
38 | + data-bs-toggle="dropdown" aria-expanded="false">Blog</a> | ||
39 | + <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownBlog"> | ||
40 | + <li><a class="dropdown-item" href="blog-home.html">Blog Home</a></li> | ||
41 | + <li><a class="dropdown-item" href="blog-post.html">Blog Post</a></li> | ||
42 | + </ul> | ||
43 | + </li> | ||
44 | + <li class="nav-item dropdown"> | ||
45 | + <a class="nav-link dropdown-toggle" id="navbarDropdownLogin" href="#" role="button" | ||
46 | + data-bs-toggle="dropdown" aria-expanded="false">Login</a> | ||
47 | + <ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdownLogin"> | ||
48 | + <li><a class="dropdown-item" href="/login">Login</a></li> | ||
49 | + <li><a class="dropdown-item" href="/signup">Sign-up</a></li> | ||
50 | + </ul> | ||
51 | + </li> | ||
52 | + </ul> | ||
53 | + </div> | ||
54 | + </div> | ||
55 | + </nav> | ||
56 | + <!-- Page Content--> | ||
57 | + <div class="container"> | ||
58 | + <br> | ||
59 | + | ||
60 | + <div class="ui raised segment"> | ||
61 | + <a class="ui blue ribbon label">게시판</a> | ||
62 | + | ||
63 | + | ||
64 | + <div class="ui blue fluid card"> | ||
65 | + <div class="content"> | ||
66 | + <br><br> | ||
67 | + <a class="ui button" href='/postadd'>글쓰기</a> | ||
68 | + | ||
69 | + </div> | ||
70 | + </div> | ||
71 | + </div> | ||
72 | + </div> | ||
73 | + </main> | ||
74 | + <!-- Footer--> | ||
75 | + <footer class="bg-dark py-4 mt-auto"> | ||
76 | + <div class="container px-5"> | ||
77 | + <div class="row align-items-center justify-content-between flex-column flex-sm-row"> | ||
78 | + <div class="col-auto"> | ||
79 | + <div class="small m-0 text-white">Copyright © Your Website 2022</div> | ||
80 | + </div> | ||
81 | + <div class="col-auto"> | ||
82 | + <a class="link-light small" href="#!">Privacy</a> | ||
83 | + <span class="text-white mx-1">·</span> | ||
84 | + <a class="link-light small" href="#!">Terms</a> | ||
85 | + <span class="text-white mx-1">·</span> | ||
86 | + <a class="link-light small" href="#!">Contact</a> | ||
87 | + </div> | ||
88 | + </div> | ||
89 | + </div> | ||
90 | + </footer> | ||
91 | + <!-- Bootstrap core JS--> | ||
92 | + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> | ||
93 | + <!-- Core theme JS--> | ||
94 | + <script src="js/scripts.js"></script> | ||
95 | +</body> | ||
96 | + | ||
97 | +</html> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -58,8 +58,8 @@ | ... | @@ -58,8 +58,8 @@ |
58 | <form method="post" action="/signup/process"> | 58 | <form method="post" action="/signup/process"> |
59 | <table> | 59 | <table> |
60 | <tr> | 60 | <tr> |
61 | - <td><label>이름</label></td> | 61 | + <td><label>E-mail</label></td> |
62 | - <td><input type="text" name="name"></td> | 62 | + <td><input type="text" name="email"></td> |
63 | </tr> | 63 | </tr> |
64 | <tr> | 64 | <tr> |
65 | <td><label>아이디</label></td> | 65 | <td><label>아이디</label></td> | ... | ... |
1 | -#!/bin/sh | 1 | +../ejs/bin/cli.js |
2 | -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | - | ||
4 | -case `uname` in | ||
5 | - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | -esac | ||
7 | - | ||
8 | -if [ -x "$basedir/node" ]; then | ||
9 | - exec "$basedir/node" "$basedir/../ejs/bin/cli.js" "$@" | ||
10 | -else | ||
11 | - exec node "$basedir/../ejs/bin/cli.js" "$@" | ||
12 | -fi | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -#!/bin/sh | 1 | +../jake/bin/cli.js |
2 | -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | - | ||
4 | -case `uname` in | ||
5 | - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | -esac | ||
7 | - | ||
8 | -if [ -x "$basedir/node" ]; then | ||
9 | - exec "$basedir/node" "$basedir/../jake/bin/cli.js" "$@" | ||
10 | -else | ||
11 | - exec node "$basedir/../jake/bin/cli.js" "$@" | ||
12 | -fi | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -#!/bin/sh | 1 | +../mime/cli.js |
2 | -basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')") | ||
3 | - | ||
4 | -case `uname` in | ||
5 | - *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;; | ||
6 | -esac | ||
7 | - | ||
8 | -if [ -x "$basedir/node" ]; then | ||
9 | - exec "$basedir/node" "$basedir/../mime/cli.js" "$@" | ||
10 | -else | ||
11 | - exec node "$basedir/../mime/cli.js" "$@" | ||
12 | -fi | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -337,9 +337,9 @@ | ... | @@ -337,9 +337,9 @@ |
337 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" | 337 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" |
338 | }, | 338 | }, |
339 | "node_modules/ejs": { | 339 | "node_modules/ejs": { |
340 | - "version": "3.1.7", | 340 | + "version": "3.1.8", |
341 | - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", | 341 | + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", |
342 | - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", | 342 | + "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", |
343 | "dependencies": { | 343 | "dependencies": { |
344 | "jake": "^10.8.5" | 344 | "jake": "^10.8.5" |
345 | }, | 345 | }, |
... | @@ -554,6 +554,11 @@ | ... | @@ -554,6 +554,11 @@ |
554 | "url": "https://github.com/sponsors/ljharb" | 554 | "url": "https://github.com/sponsors/ljharb" |
555 | } | 555 | } |
556 | }, | 556 | }, |
557 | + "node_modules/html-entities": { | ||
558 | + "version": "2.3.3", | ||
559 | + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", | ||
560 | + "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==" | ||
561 | + }, | ||
557 | "node_modules/http": { | 562 | "node_modules/http": { |
558 | "version": "0.0.1-security", | 563 | "version": "0.0.1-security", |
559 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz", | 564 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz", | ... | ... |
... | @@ -55,6 +55,9 @@ for all the passed options. However, be aware that your code could break if we | ... | @@ -55,6 +55,9 @@ for all the passed options. However, be aware that your code could break if we |
55 | add an option with the same name as one of your data object's properties. | 55 | add an option with the same name as one of your data object's properties. |
56 | Therefore, we do not recommend using this shortcut. | 56 | Therefore, we do not recommend using this shortcut. |
57 | 57 | ||
58 | +### Important | ||
59 | +You should never give end-users unfettered access to the EJS render method, If you do so you are using EJS in an inherently un-secure way. | ||
60 | + | ||
58 | ### Options | 61 | ### Options |
59 | 62 | ||
60 | - `cache` Compiled functions are cached, requires `filename` | 63 | - `cache` Compiled functions are cached, requires `filename` | ... | ... |
... | @@ -979,6 +979,8 @@ if (typeof window != 'undefined') { | ... | @@ -979,6 +979,8 @@ if (typeof window != 'undefined') { |
979 | 'use strict'; | 979 | 'use strict'; |
980 | 980 | ||
981 | var regExpChars = /[|\\{}()[\]^$+*?.]/g; | 981 | var regExpChars = /[|\\{}()[\]^$+*?.]/g; |
982 | +var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
983 | +var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); }; | ||
982 | 984 | ||
983 | /** | 985 | /** |
984 | * Escape characters reserved in regular expressions. | 986 | * Escape characters reserved in regular expressions. |
... | @@ -1070,6 +1072,12 @@ exports.shallowCopy = function (to, from) { | ... | @@ -1070,6 +1072,12 @@ exports.shallowCopy = function (to, from) { |
1070 | from = from || {}; | 1072 | from = from || {}; |
1071 | if ((to !== null) && (to !== undefined)) { | 1073 | if ((to !== null) && (to !== undefined)) { |
1072 | for (var p in from) { | 1074 | for (var p in from) { |
1075 | + if (!hasOwn(from, p)) { | ||
1076 | + continue; | ||
1077 | + } | ||
1078 | + if (p === '__proto__' || p === 'constructor') { | ||
1079 | + continue; | ||
1080 | + } | ||
1073 | to[p] = from[p]; | 1081 | to[p] = from[p]; |
1074 | } | 1082 | } |
1075 | } | 1083 | } |
... | @@ -1095,6 +1103,12 @@ exports.shallowCopyFromList = function (to, from, list) { | ... | @@ -1095,6 +1103,12 @@ exports.shallowCopyFromList = function (to, from, list) { |
1095 | for (var i = 0; i < list.length; i++) { | 1103 | for (var i = 0; i < list.length; i++) { |
1096 | var p = list[i]; | 1104 | var p = list[i]; |
1097 | if (typeof from[p] != 'undefined') { | 1105 | if (typeof from[p] != 'undefined') { |
1106 | + if (!hasOwn(from, p)) { | ||
1107 | + continue; | ||
1108 | + } | ||
1109 | + if (p === '__proto__' || p === 'constructor') { | ||
1110 | + continue; | ||
1111 | + } | ||
1098 | to[p] = from[p]; | 1112 | to[p] = from[p]; |
1099 | } | 1113 | } |
1100 | } | 1114 | } |
... | @@ -1667,7 +1681,7 @@ module.exports={ | ... | @@ -1667,7 +1681,7 @@ module.exports={ |
1667 | "engine", | 1681 | "engine", |
1668 | "ejs" | 1682 | "ejs" |
1669 | ], | 1683 | ], |
1670 | - "version": "3.1.6", | 1684 | + "version": "3.1.7", |
1671 | "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | 1685 | "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", |
1672 | "license": "Apache-2.0", | 1686 | "license": "Apache-2.0", |
1673 | "bin": { | 1687 | "bin": { | ... | ... |
1 | -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ejs=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){"use strict";var fs=require("fs");var path=require("path");var utils=require("./utils");var scopeOptionWarned=false;var _VERSION_STRING=require("../package.json").version;var _DEFAULT_OPEN_DELIMITER="<";var _DEFAULT_CLOSE_DELIMITER=">";var _DEFAULT_DELIMITER="%";var _DEFAULT_LOCALS_NAME="locals";var _NAME="ejs";var _REGEX_STRING="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";var _OPTS_PASSABLE_WITH_DATA=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"];var _OPTS_PASSABLE_WITH_DATA_EXPRESS=_OPTS_PASSABLE_WITH_DATA.concat("cache");var _BOM=/^\uFEFF/;var _JS_IDENTIFIER=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;exports.cache=utils.cache;exports.fileLoader=fs.readFileSync;exports.localsName=_DEFAULT_LOCALS_NAME;exports.promiseImpl=new Function("return this;")().Promise;exports.resolveInclude=function(name,filename,isDir){var dirname=path.dirname;var extname=path.extname;var resolve=path.resolve;var includePath=resolve(isDir?filename:dirname(filename),name);var ext=extname(name);if(!ext){includePath+=".ejs"}return includePath};function resolvePaths(name,paths){var filePath;if(paths.some(function(v){filePath=exports.resolveInclude(name,v,true);return fs.existsSync(filePath)})){return filePath}}function getIncludePath(path,options){var includePath;var filePath;var views=options.views;var match=/^[A-Za-z]+:\\|^\//.exec(path);if(match&&match.length){path=path.replace(/^\/*/,"");if(Array.isArray(options.root)){includePath=resolvePaths(path,options.root)}else{includePath=exports.resolveInclude(path,options.root||"/",true)}}else{if(options.filename){filePath=exports.resolveInclude(path,options.filename);if(fs.existsSync(filePath)){includePath=filePath}}if(!includePath&&Array.isArray(views)){includePath=resolvePaths(path,views)}if(!includePath&&typeof options.includer!=="function"){throw new Error('Could not find the include file "'+options.escapeFunction(path)+'"')}}return includePath}function handleCache(options,template){var func;var filename=options.filename;var hasTemplate=arguments.length>1;if(options.cache){if(!filename){throw new Error("cache option requires a filename")}func=exports.cache.get(filename);if(func){return func}if(!hasTemplate){template=fileLoader(filename).toString().replace(_BOM,"")}}else if(!hasTemplate){if(!filename){throw new Error("Internal EJS error: no file name or template "+"provided")}template=fileLoader(filename).toString().replace(_BOM,"")}func=exports.compile(template,options);if(options.cache){exports.cache.set(filename,func)}return func}function tryHandleCache(options,data,cb){var result;if(!cb){if(typeof exports.promiseImpl=="function"){return new exports.promiseImpl(function(resolve,reject){try{result=handleCache(options)(data);resolve(result)}catch(err){reject(err)}})}else{throw new Error("Please provide a callback function")}}else{try{result=handleCache(options)(data)}catch(err){return cb(err)}cb(null,result)}}function fileLoader(filePath){return exports.fileLoader(filePath)}function includeFile(path,options){var opts=utils.shallowCopy(utils.createNullProtoObjWherePossible(),options);opts.filename=getIncludePath(path,opts);if(typeof options.includer==="function"){var includerResult=options.includer(path,opts.filename);if(includerResult){if(includerResult.filename){opts.filename=includerResult.filename}if(includerResult.template){return handleCache(opts,includerResult.template)}}}return handleCache(opts)}function rethrow(err,str,flnm,lineno,esc){var lines=str.split("\n");var start=Math.max(lineno-3,0);var end=Math.min(lines.length,lineno+3);var filename=esc(flnm);var context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");err.path=filename;err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function stripSemi(str){return str.replace(/;(\s*$)/,"$1")}exports.compile=function compile(template,opts){var templ;if(opts&&opts.scope){if(!scopeOptionWarned){console.warn("`scope` option is deprecated and will be removed in EJS 3");scopeOptionWarned=true}if(!opts.context){opts.context=opts.scope}delete opts.scope}templ=new Template(template,opts);return templ.compile()};exports.render=function(template,d,o){var data=d||utils.createNullProtoObjWherePossible();var opts=o||utils.createNullProtoObjWherePossible();if(arguments.length==2){utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA)}return handleCache(opts,template)(data)};exports.renderFile=function(){var args=Array.prototype.slice.call(arguments);var filename=args.shift();var cb;var opts={filename:filename};var data;var viewOpts;if(typeof arguments[arguments.length-1]=="function"){cb=args.pop()}if(args.length){data=args.shift();if(args.length){utils.shallowCopy(opts,args.pop())}else{if(data.settings){if(data.settings.views){opts.views=data.settings.views}if(data.settings["view cache"]){opts.cache=true}viewOpts=data.settings["view options"];if(viewOpts){utils.shallowCopy(opts,viewOpts)}}utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA_EXPRESS)}opts.filename=filename}else{data=utils.createNullProtoObjWherePossible()}return tryHandleCache(opts,data,cb)};exports.Template=Template;exports.clearCache=function(){exports.cache.reset()};function Template(text,opts){opts=opts||utils.createNullProtoObjWherePossible();var options=utils.createNullProtoObjWherePossible();this.templateText=text;this.mode=null;this.truncate=false;this.currentLine=1;this.source="";options.client=opts.client||false;options.escapeFunction=opts.escape||opts.escapeFunction||utils.escapeXML;options.compileDebug=opts.compileDebug!==false;options.debug=!!opts.debug;options.filename=opts.filename;options.openDelimiter=opts.openDelimiter||exports.openDelimiter||_DEFAULT_OPEN_DELIMITER;options.closeDelimiter=opts.closeDelimiter||exports.closeDelimiter||_DEFAULT_CLOSE_DELIMITER;options.delimiter=opts.delimiter||exports.delimiter||_DEFAULT_DELIMITER;options.strict=opts.strict||false;options.context=opts.context;options.cache=opts.cache||false;options.rmWhitespace=opts.rmWhitespace;options.root=opts.root;options.includer=opts.includer;options.outputFunctionName=opts.outputFunctionName;options.localsName=opts.localsName||exports.localsName||_DEFAULT_LOCALS_NAME;options.views=opts.views;options.async=opts.async;options.destructuredLocals=opts.destructuredLocals;options.legacyInclude=typeof opts.legacyInclude!="undefined"?!!opts.legacyInclude:true;if(options.strict){options._with=false}else{options._with=typeof opts._with!="undefined"?opts._with:true}this.opts=options;this.regex=this.createRegex()}Template.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Template.prototype={createRegex:function(){var str=_REGEX_STRING;var delim=utils.escapeRegExpChars(this.opts.delimiter);var open=utils.escapeRegExpChars(this.opts.openDelimiter);var close=utils.escapeRegExpChars(this.opts.closeDelimiter);str=str.replace(/%/g,delim).replace(/</g,open).replace(/>/g,close);return new RegExp(str)},compile:function(){var src;var fn;var opts=this.opts;var prepended="";var appended="";var escapeFn=opts.escapeFunction;var ctor;var sanitizedFilename=opts.filename?JSON.stringify(opts.filename):"undefined";if(!this.source){this.generateSource();prepended+=' var __output = "";\n'+" function __append(s) { if (s !== undefined && s !== null) __output += s }\n";if(opts.outputFunctionName){if(!_JS_IDENTIFIER.test(opts.outputFunctionName)){throw new Error("outputFunctionName is not a valid JS identifier.")}prepended+=" var "+opts.outputFunctionName+" = __append;"+"\n"}if(opts.localsName&&!_JS_IDENTIFIER.test(opts.localsName)){throw new Error("localsName is not a valid JS identifier.")}if(opts.destructuredLocals&&opts.destructuredLocals.length){var destructuring=" var __locals = ("+opts.localsName+" || {}),\n";for(var i=0;i<opts.destructuredLocals.length;i++){var name=opts.destructuredLocals[i];if(!_JS_IDENTIFIER.test(name)){throw new Error("destructuredLocals["+i+"] is not a valid JS identifier.")}if(i>0){destructuring+=",\n "}destructuring+=name+" = __locals."+name}prepended+=destructuring+";\n"}if(opts._with!==false){prepended+=" with ("+opts.localsName+" || {}) {"+"\n";appended+=" }"+"\n"}appended+=" return __output;"+"\n";this.source=prepended+this.source+appended}if(opts.compileDebug){src="var __line = 1"+"\n"+" , __lines = "+JSON.stringify(this.templateText)+"\n"+" , __filename = "+sanitizedFilename+";"+"\n"+"try {"+"\n"+this.source+"} catch (e) {"+"\n"+" rethrow(e, __lines, __filename, __line, escapeFn);"+"\n"+"}"+"\n"}else{src=this.source}if(opts.client){src="escapeFn = escapeFn || "+escapeFn.toString()+";"+"\n"+src;if(opts.compileDebug){src="rethrow = rethrow || "+rethrow.toString()+";"+"\n"+src}}if(opts.strict){src='"use strict";\n'+src}if(opts.debug){console.log(src)}if(opts.compileDebug&&opts.filename){src=src+"\n"+"//# sourceURL="+sanitizedFilename+"\n"}try{if(opts.async){try{ctor=new Function("return (async function(){}).constructor;")()}catch(e){if(e instanceof SyntaxError){throw new Error("This environment does not support async/await")}else{throw e}}}else{ctor=Function}fn=new ctor(opts.localsName+", escapeFn, include, rethrow",src)}catch(e){if(e instanceof SyntaxError){if(opts.filename){e.message+=" in "+opts.filename}e.message+=" while compiling ejs\n\n";e.message+="If the above error is not helpful, you may want to try EJS-Lint:\n";e.message+="https://github.com/RyanZim/EJS-Lint";if(!opts.async){e.message+="\n";e.message+="Or, if you meant to create an async function, pass `async: true` as an option."}}throw e}var returnedFn=opts.client?fn:function anonymous(data){var include=function(path,includeData){var d=utils.shallowCopy(utils.createNullProtoObjWherePossible(),data);if(includeData){d=utils.shallowCopy(d,includeData)}return includeFile(path,opts)(d)};return fn.apply(opts.context,[data||utils.createNullProtoObjWherePossible(),escapeFn,include,rethrow])};if(opts.filename&&typeof Object.defineProperty==="function"){var filename=opts.filename;var basename=path.basename(filename,path.extname(filename));try{Object.defineProperty(returnedFn,"name",{value:basename,writable:false,enumerable:false,configurable:true})}catch(e){}}return returnedFn},generateSource:function(){var opts=this.opts;if(opts.rmWhitespace){this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var self=this;var matches=this.parseTemplateText();var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;if(matches&&matches.length){matches.forEach(function(line,index){var closing;if(line.indexOf(o+d)===0&&line.indexOf(o+d+d)!==0){closing=matches[index+2];if(!(closing==d+c||closing=="-"+d+c||closing=="_"+d+c)){throw new Error('Could not find matching close tag for "'+line+'".')}}self.scanLine(line)})}},parseTemplateText:function(){var str=this.templateText;var pat=this.regex;var result=pat.exec(str);var arr=[];var firstPos;while(result){firstPos=result.index;if(firstPos!==0){arr.push(str.substring(0,firstPos));str=str.slice(firstPos)}arr.push(result[0]);str=str.slice(result[0].length);result=pat.exec(str)}if(str){arr.push(str)}return arr},_addOutput:function(line){if(this.truncate){line=line.replace(/^(?:\r\n|\r|\n)/,"");this.truncate=false}if(!line){return line}line=line.replace(/\\/g,"\\\\");line=line.replace(/\n/g,"\\n");line=line.replace(/\r/g,"\\r");line=line.replace(/"/g,'\\"');this.source+=' ; __append("'+line+'")'+"\n"},scanLine:function(line){var self=this;var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;var newLineCount=0;newLineCount=line.split("\n").length-1;switch(line){case o+d:case o+d+"_":this.mode=Template.modes.EVAL;break;case o+d+"=":this.mode=Template.modes.ESCAPED;break;case o+d+"-":this.mode=Template.modes.RAW;break;case o+d+"#":this.mode=Template.modes.COMMENT;break;case o+d+d:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(o+d+d,o+d)+'")'+"\n";break;case d+d+c:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(d+d+c,d+c)+'")'+"\n";break;case d+c:case"-"+d+c:case"_"+d+c:if(this.mode==Template.modes.LITERAL){this._addOutput(line)}this.mode=null;this.truncate=line.indexOf("-")===0||line.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case Template.modes.EVAL:case Template.modes.ESCAPED:case Template.modes.RAW:if(line.lastIndexOf("//")>line.lastIndexOf("\n")){line+="\n"}}switch(this.mode){case Template.modes.EVAL:this.source+=" ; "+line+"\n";break;case Template.modes.ESCAPED:this.source+=" ; __append(escapeFn("+stripSemi(line)+"))"+"\n";break;case Template.modes.RAW:this.source+=" ; __append("+stripSemi(line)+")"+"\n";break;case Template.modes.COMMENT:break;case Template.modes.LITERAL:this._addOutput(line);break}}else{this._addOutput(line)}}if(self.opts.compileDebug&&newLineCount){this.currentLine+=newLineCount;this.source+=" ; __line = "+this.currentLine+"\n"}}};exports.escapeXML=utils.escapeXML;exports.__express=exports.renderFile;exports.VERSION=_VERSION_STRING;exports.name=_NAME;if(typeof window!="undefined"){window.ejs=exports}},{"../package.json":6,"./utils":2,fs:3,path:4}],2:[function(require,module,exports){"use strict";var regExpChars=/[|\\{}()[\]^$+*?.]/g;exports.escapeRegExpChars=function(string){if(!string){return""}return String(string).replace(regExpChars,"\\$&")};var _ENCODE_HTML_RULES={"&":"&","<":"<",">":">",'"':""","'":"'"};var _MATCH_HTML=/[&<>'"]/g;function encode_char(c){return _ENCODE_HTML_RULES[c]||c}var escapeFuncStr="var _ENCODE_HTML_RULES = {\n"+' "&": "&"\n'+' , "<": "<"\n'+' , ">": ">"\n'+' , \'"\': """\n'+' , "\'": "'"\n'+" }\n"+" , _MATCH_HTML = /[&<>'\"]/g;\n"+"function encode_char(c) {\n"+" return _ENCODE_HTML_RULES[c] || c;\n"+"};\n";exports.escapeXML=function(markup){return markup==undefined?"":String(markup).replace(_MATCH_HTML,encode_char)};exports.escapeXML.toString=function(){return Function.prototype.toString.call(this)+";\n"+escapeFuncStr};exports.shallowCopy=function(to,from){from=from||{};if(to!==null&&to!==undefined){for(var p in from){to[p]=from[p]}}return to};exports.shallowCopyFromList=function(to,from,list){list=list||[];from=from||{};if(to!==null&&to!==undefined){for(var i=0;i<list.length;i++){var p=list[i];if(typeof from[p]!="undefined"){to[p]=from[p]}}}return to};exports.cache={_data:{},set:function(key,val){this._data[key]=val},get:function(key){return this._data[key]},remove:function(key){delete this._data[key]},reset:function(){this._data={}}};exports.hyphenToCamel=function(str){return str.replace(/-[a-z]/g,function(match){return match[1].toUpperCase()})};exports.createNullProtoObjWherePossible=function(){if(typeof Object.create=="function"){return function(){return Object.create(null)}}if(!({__proto__:null}instanceof Object)){return function(){return{__proto__:null}}}return function(){return{}}}()},{}],3:[function(require,module,exports){},{}],4:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){if(typeof path!=="string")path=path+"";if(path.length===0)return".";var code=path.charCodeAt(0);var hasRoot=code===47;var end=-1;var matchedSlash=true;for(var i=path.length-1;i>=1;--i){code=path.charCodeAt(i);if(code===47){if(!matchedSlash){end=i;break}}else{matchedSlash=false}}if(end===-1)return hasRoot?"/":".";if(hasRoot&&end===1){return"/"}return path.slice(0,end)};function basename(path){if(typeof path!=="string")path=path+"";var start=0;var end=-1;var matchedSlash=true;var i;for(i=path.length-1;i>=0;--i){if(path.charCodeAt(i)===47){if(!matchedSlash){start=i+1;break}}else if(end===-1){matchedSlash=false;end=i+1}}if(end===-1)return"";return path.slice(start,end)}exports.basename=function(path,ext){var f=basename(path);if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){if(typeof path!=="string")path=path+"";var startDot=-1;var startPart=0;var end=-1;var matchedSlash=true;var preDotState=0;for(var i=path.length-1;i>=0;--i){var code=path.charCodeAt(i);if(code===47){if(!matchedSlash){startPart=i+1;break}continue}if(end===-1){matchedSlash=false;end=i+1}if(code===46){if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1}else if(startDot!==-1){preDotState=-1}}if(startDot===-1||end===-1||preDotState===0||preDotState===1&&startDot===end-1&&startDot===startPart+1){return""}return path.slice(startDot,end)};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:5}],5:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],6:[function(require,module,exports){module.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.1.6",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",bin:{ejs:"./bin/cli.js"},main:"./lib/ejs.js",jsdelivr:"ejs.min.js",unpkg:"ejs.min.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{jake:"^10.8.5"},devDependencies:{browserify:"^16.5.1",eslint:"^6.8.0","git-directory-deploy":"^1.5.1",jsdoc:"^3.6.7","lru-cache":"^4.0.1",mocha:"^7.1.1","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"mocha"}}},{}]},{},[1])(1)}); | 1 | +(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ejs=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){"use strict";var fs=require("fs");var path=require("path");var utils=require("./utils");var scopeOptionWarned=false;var _VERSION_STRING=require("../package.json").version;var _DEFAULT_OPEN_DELIMITER="<";var _DEFAULT_CLOSE_DELIMITER=">";var _DEFAULT_DELIMITER="%";var _DEFAULT_LOCALS_NAME="locals";var _NAME="ejs";var _REGEX_STRING="(<%%|%%>|<%=|<%-|<%_|<%#|<%|%>|-%>|_%>)";var _OPTS_PASSABLE_WITH_DATA=["delimiter","scope","context","debug","compileDebug","client","_with","rmWhitespace","strict","filename","async"];var _OPTS_PASSABLE_WITH_DATA_EXPRESS=_OPTS_PASSABLE_WITH_DATA.concat("cache");var _BOM=/^\uFEFF/;var _JS_IDENTIFIER=/^[a-zA-Z_$][0-9a-zA-Z_$]*$/;exports.cache=utils.cache;exports.fileLoader=fs.readFileSync;exports.localsName=_DEFAULT_LOCALS_NAME;exports.promiseImpl=new Function("return this;")().Promise;exports.resolveInclude=function(name,filename,isDir){var dirname=path.dirname;var extname=path.extname;var resolve=path.resolve;var includePath=resolve(isDir?filename:dirname(filename),name);var ext=extname(name);if(!ext){includePath+=".ejs"}return includePath};function resolvePaths(name,paths){var filePath;if(paths.some(function(v){filePath=exports.resolveInclude(name,v,true);return fs.existsSync(filePath)})){return filePath}}function getIncludePath(path,options){var includePath;var filePath;var views=options.views;var match=/^[A-Za-z]+:\\|^\//.exec(path);if(match&&match.length){path=path.replace(/^\/*/,"");if(Array.isArray(options.root)){includePath=resolvePaths(path,options.root)}else{includePath=exports.resolveInclude(path,options.root||"/",true)}}else{if(options.filename){filePath=exports.resolveInclude(path,options.filename);if(fs.existsSync(filePath)){includePath=filePath}}if(!includePath&&Array.isArray(views)){includePath=resolvePaths(path,views)}if(!includePath&&typeof options.includer!=="function"){throw new Error('Could not find the include file "'+options.escapeFunction(path)+'"')}}return includePath}function handleCache(options,template){var func;var filename=options.filename;var hasTemplate=arguments.length>1;if(options.cache){if(!filename){throw new Error("cache option requires a filename")}func=exports.cache.get(filename);if(func){return func}if(!hasTemplate){template=fileLoader(filename).toString().replace(_BOM,"")}}else if(!hasTemplate){if(!filename){throw new Error("Internal EJS error: no file name or template "+"provided")}template=fileLoader(filename).toString().replace(_BOM,"")}func=exports.compile(template,options);if(options.cache){exports.cache.set(filename,func)}return func}function tryHandleCache(options,data,cb){var result;if(!cb){if(typeof exports.promiseImpl=="function"){return new exports.promiseImpl(function(resolve,reject){try{result=handleCache(options)(data);resolve(result)}catch(err){reject(err)}})}else{throw new Error("Please provide a callback function")}}else{try{result=handleCache(options)(data)}catch(err){return cb(err)}cb(null,result)}}function fileLoader(filePath){return exports.fileLoader(filePath)}function includeFile(path,options){var opts=utils.shallowCopy(utils.createNullProtoObjWherePossible(),options);opts.filename=getIncludePath(path,opts);if(typeof options.includer==="function"){var includerResult=options.includer(path,opts.filename);if(includerResult){if(includerResult.filename){opts.filename=includerResult.filename}if(includerResult.template){return handleCache(opts,includerResult.template)}}}return handleCache(opts)}function rethrow(err,str,flnm,lineno,esc){var lines=str.split("\n");var start=Math.max(lineno-3,0);var end=Math.min(lines.length,lineno+3);var filename=esc(flnm);var context=lines.slice(start,end).map(function(line,i){var curr=i+start+1;return(curr==lineno?" >> ":" ")+curr+"| "+line}).join("\n");err.path=filename;err.message=(filename||"ejs")+":"+lineno+"\n"+context+"\n\n"+err.message;throw err}function stripSemi(str){return str.replace(/;(\s*$)/,"$1")}exports.compile=function compile(template,opts){var templ;if(opts&&opts.scope){if(!scopeOptionWarned){console.warn("`scope` option is deprecated and will be removed in EJS 3");scopeOptionWarned=true}if(!opts.context){opts.context=opts.scope}delete opts.scope}templ=new Template(template,opts);return templ.compile()};exports.render=function(template,d,o){var data=d||utils.createNullProtoObjWherePossible();var opts=o||utils.createNullProtoObjWherePossible();if(arguments.length==2){utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA)}return handleCache(opts,template)(data)};exports.renderFile=function(){var args=Array.prototype.slice.call(arguments);var filename=args.shift();var cb;var opts={filename:filename};var data;var viewOpts;if(typeof arguments[arguments.length-1]=="function"){cb=args.pop()}if(args.length){data=args.shift();if(args.length){utils.shallowCopy(opts,args.pop())}else{if(data.settings){if(data.settings.views){opts.views=data.settings.views}if(data.settings["view cache"]){opts.cache=true}viewOpts=data.settings["view options"];if(viewOpts){utils.shallowCopy(opts,viewOpts)}}utils.shallowCopyFromList(opts,data,_OPTS_PASSABLE_WITH_DATA_EXPRESS)}opts.filename=filename}else{data=utils.createNullProtoObjWherePossible()}return tryHandleCache(opts,data,cb)};exports.Template=Template;exports.clearCache=function(){exports.cache.reset()};function Template(text,opts){opts=opts||utils.createNullProtoObjWherePossible();var options=utils.createNullProtoObjWherePossible();this.templateText=text;this.mode=null;this.truncate=false;this.currentLine=1;this.source="";options.client=opts.client||false;options.escapeFunction=opts.escape||opts.escapeFunction||utils.escapeXML;options.compileDebug=opts.compileDebug!==false;options.debug=!!opts.debug;options.filename=opts.filename;options.openDelimiter=opts.openDelimiter||exports.openDelimiter||_DEFAULT_OPEN_DELIMITER;options.closeDelimiter=opts.closeDelimiter||exports.closeDelimiter||_DEFAULT_CLOSE_DELIMITER;options.delimiter=opts.delimiter||exports.delimiter||_DEFAULT_DELIMITER;options.strict=opts.strict||false;options.context=opts.context;options.cache=opts.cache||false;options.rmWhitespace=opts.rmWhitespace;options.root=opts.root;options.includer=opts.includer;options.outputFunctionName=opts.outputFunctionName;options.localsName=opts.localsName||exports.localsName||_DEFAULT_LOCALS_NAME;options.views=opts.views;options.async=opts.async;options.destructuredLocals=opts.destructuredLocals;options.legacyInclude=typeof opts.legacyInclude!="undefined"?!!opts.legacyInclude:true;if(options.strict){options._with=false}else{options._with=typeof opts._with!="undefined"?opts._with:true}this.opts=options;this.regex=this.createRegex()}Template.modes={EVAL:"eval",ESCAPED:"escaped",RAW:"raw",COMMENT:"comment",LITERAL:"literal"};Template.prototype={createRegex:function(){var str=_REGEX_STRING;var delim=utils.escapeRegExpChars(this.opts.delimiter);var open=utils.escapeRegExpChars(this.opts.openDelimiter);var close=utils.escapeRegExpChars(this.opts.closeDelimiter);str=str.replace(/%/g,delim).replace(/</g,open).replace(/>/g,close);return new RegExp(str)},compile:function(){var src;var fn;var opts=this.opts;var prepended="";var appended="";var escapeFn=opts.escapeFunction;var ctor;var sanitizedFilename=opts.filename?JSON.stringify(opts.filename):"undefined";if(!this.source){this.generateSource();prepended+=' var __output = "";\n'+" function __append(s) { if (s !== undefined && s !== null) __output += s }\n";if(opts.outputFunctionName){if(!_JS_IDENTIFIER.test(opts.outputFunctionName)){throw new Error("outputFunctionName is not a valid JS identifier.")}prepended+=" var "+opts.outputFunctionName+" = __append;"+"\n"}if(opts.localsName&&!_JS_IDENTIFIER.test(opts.localsName)){throw new Error("localsName is not a valid JS identifier.")}if(opts.destructuredLocals&&opts.destructuredLocals.length){var destructuring=" var __locals = ("+opts.localsName+" || {}),\n";for(var i=0;i<opts.destructuredLocals.length;i++){var name=opts.destructuredLocals[i];if(!_JS_IDENTIFIER.test(name)){throw new Error("destructuredLocals["+i+"] is not a valid JS identifier.")}if(i>0){destructuring+=",\n "}destructuring+=name+" = __locals."+name}prepended+=destructuring+";\n"}if(opts._with!==false){prepended+=" with ("+opts.localsName+" || {}) {"+"\n";appended+=" }"+"\n"}appended+=" return __output;"+"\n";this.source=prepended+this.source+appended}if(opts.compileDebug){src="var __line = 1"+"\n"+" , __lines = "+JSON.stringify(this.templateText)+"\n"+" , __filename = "+sanitizedFilename+";"+"\n"+"try {"+"\n"+this.source+"} catch (e) {"+"\n"+" rethrow(e, __lines, __filename, __line, escapeFn);"+"\n"+"}"+"\n"}else{src=this.source}if(opts.client){src="escapeFn = escapeFn || "+escapeFn.toString()+";"+"\n"+src;if(opts.compileDebug){src="rethrow = rethrow || "+rethrow.toString()+";"+"\n"+src}}if(opts.strict){src='"use strict";\n'+src}if(opts.debug){console.log(src)}if(opts.compileDebug&&opts.filename){src=src+"\n"+"//# sourceURL="+sanitizedFilename+"\n"}try{if(opts.async){try{ctor=new Function("return (async function(){}).constructor;")()}catch(e){if(e instanceof SyntaxError){throw new Error("This environment does not support async/await")}else{throw e}}}else{ctor=Function}fn=new ctor(opts.localsName+", escapeFn, include, rethrow",src)}catch(e){if(e instanceof SyntaxError){if(opts.filename){e.message+=" in "+opts.filename}e.message+=" while compiling ejs\n\n";e.message+="If the above error is not helpful, you may want to try EJS-Lint:\n";e.message+="https://github.com/RyanZim/EJS-Lint";if(!opts.async){e.message+="\n";e.message+="Or, if you meant to create an async function, pass `async: true` as an option."}}throw e}var returnedFn=opts.client?fn:function anonymous(data){var include=function(path,includeData){var d=utils.shallowCopy(utils.createNullProtoObjWherePossible(),data);if(includeData){d=utils.shallowCopy(d,includeData)}return includeFile(path,opts)(d)};return fn.apply(opts.context,[data||utils.createNullProtoObjWherePossible(),escapeFn,include,rethrow])};if(opts.filename&&typeof Object.defineProperty==="function"){var filename=opts.filename;var basename=path.basename(filename,path.extname(filename));try{Object.defineProperty(returnedFn,"name",{value:basename,writable:false,enumerable:false,configurable:true})}catch(e){}}return returnedFn},generateSource:function(){var opts=this.opts;if(opts.rmWhitespace){this.templateText=this.templateText.replace(/[\r\n]+/g,"\n").replace(/^\s+|\s+$/gm,"")}this.templateText=this.templateText.replace(/[ \t]*<%_/gm,"<%_").replace(/_%>[ \t]*/gm,"_%>");var self=this;var matches=this.parseTemplateText();var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;if(matches&&matches.length){matches.forEach(function(line,index){var closing;if(line.indexOf(o+d)===0&&line.indexOf(o+d+d)!==0){closing=matches[index+2];if(!(closing==d+c||closing=="-"+d+c||closing=="_"+d+c)){throw new Error('Could not find matching close tag for "'+line+'".')}}self.scanLine(line)})}},parseTemplateText:function(){var str=this.templateText;var pat=this.regex;var result=pat.exec(str);var arr=[];var firstPos;while(result){firstPos=result.index;if(firstPos!==0){arr.push(str.substring(0,firstPos));str=str.slice(firstPos)}arr.push(result[0]);str=str.slice(result[0].length);result=pat.exec(str)}if(str){arr.push(str)}return arr},_addOutput:function(line){if(this.truncate){line=line.replace(/^(?:\r\n|\r|\n)/,"");this.truncate=false}if(!line){return line}line=line.replace(/\\/g,"\\\\");line=line.replace(/\n/g,"\\n");line=line.replace(/\r/g,"\\r");line=line.replace(/"/g,'\\"');this.source+=' ; __append("'+line+'")'+"\n"},scanLine:function(line){var self=this;var d=this.opts.delimiter;var o=this.opts.openDelimiter;var c=this.opts.closeDelimiter;var newLineCount=0;newLineCount=line.split("\n").length-1;switch(line){case o+d:case o+d+"_":this.mode=Template.modes.EVAL;break;case o+d+"=":this.mode=Template.modes.ESCAPED;break;case o+d+"-":this.mode=Template.modes.RAW;break;case o+d+"#":this.mode=Template.modes.COMMENT;break;case o+d+d:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(o+d+d,o+d)+'")'+"\n";break;case d+d+c:this.mode=Template.modes.LITERAL;this.source+=' ; __append("'+line.replace(d+d+c,d+c)+'")'+"\n";break;case d+c:case"-"+d+c:case"_"+d+c:if(this.mode==Template.modes.LITERAL){this._addOutput(line)}this.mode=null;this.truncate=line.indexOf("-")===0||line.indexOf("_")===0;break;default:if(this.mode){switch(this.mode){case Template.modes.EVAL:case Template.modes.ESCAPED:case Template.modes.RAW:if(line.lastIndexOf("//")>line.lastIndexOf("\n")){line+="\n"}}switch(this.mode){case Template.modes.EVAL:this.source+=" ; "+line+"\n";break;case Template.modes.ESCAPED:this.source+=" ; __append(escapeFn("+stripSemi(line)+"))"+"\n";break;case Template.modes.RAW:this.source+=" ; __append("+stripSemi(line)+")"+"\n";break;case Template.modes.COMMENT:break;case Template.modes.LITERAL:this._addOutput(line);break}}else{this._addOutput(line)}}if(self.opts.compileDebug&&newLineCount){this.currentLine+=newLineCount;this.source+=" ; __line = "+this.currentLine+"\n"}}};exports.escapeXML=utils.escapeXML;exports.__express=exports.renderFile;exports.VERSION=_VERSION_STRING;exports.name=_NAME;if(typeof window!="undefined"){window.ejs=exports}},{"../package.json":6,"./utils":2,fs:3,path:4}],2:[function(require,module,exports){"use strict";var regExpChars=/[|\\{}()[\]^$+*?.]/g;var hasOwnProperty=Object.prototype.hasOwnProperty;var hasOwn=function(obj,key){return hasOwnProperty.apply(obj,[key])};exports.escapeRegExpChars=function(string){if(!string){return""}return String(string).replace(regExpChars,"\\$&")};var _ENCODE_HTML_RULES={"&":"&","<":"<",">":">",'"':""","'":"'"};var _MATCH_HTML=/[&<>'"]/g;function encode_char(c){return _ENCODE_HTML_RULES[c]||c}var escapeFuncStr="var _ENCODE_HTML_RULES = {\n"+' "&": "&"\n'+' , "<": "<"\n'+' , ">": ">"\n'+' , \'"\': """\n'+' , "\'": "'"\n'+" }\n"+" , _MATCH_HTML = /[&<>'\"]/g;\n"+"function encode_char(c) {\n"+" return _ENCODE_HTML_RULES[c] || c;\n"+"};\n";exports.escapeXML=function(markup){return markup==undefined?"":String(markup).replace(_MATCH_HTML,encode_char)};exports.escapeXML.toString=function(){return Function.prototype.toString.call(this)+";\n"+escapeFuncStr};exports.shallowCopy=function(to,from){from=from||{};if(to!==null&&to!==undefined){for(var p in from){if(!hasOwn(from,p)){continue}if(p==="__proto__"||p==="constructor"){continue}to[p]=from[p]}}return to};exports.shallowCopyFromList=function(to,from,list){list=list||[];from=from||{};if(to!==null&&to!==undefined){for(var i=0;i<list.length;i++){var p=list[i];if(typeof from[p]!="undefined"){if(!hasOwn(from,p)){continue}if(p==="__proto__"||p==="constructor"){continue}to[p]=from[p]}}}return to};exports.cache={_data:{},set:function(key,val){this._data[key]=val},get:function(key){return this._data[key]},remove:function(key){delete this._data[key]},reset:function(){this._data={}}};exports.hyphenToCamel=function(str){return str.replace(/-[a-z]/g,function(match){return match[1].toUpperCase()})};exports.createNullProtoObjWherePossible=function(){if(typeof Object.create=="function"){return function(){return Object.create(null)}}if(!({__proto__:null}instanceof Object)){return function(){return{__proto__:null}}}return function(){return{}}}()},{}],3:[function(require,module,exports){},{}],4:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){if(typeof path!=="string")path=path+"";if(path.length===0)return".";var code=path.charCodeAt(0);var hasRoot=code===47;var end=-1;var matchedSlash=true;for(var i=path.length-1;i>=1;--i){code=path.charCodeAt(i);if(code===47){if(!matchedSlash){end=i;break}}else{matchedSlash=false}}if(end===-1)return hasRoot?"/":".";if(hasRoot&&end===1){return"/"}return path.slice(0,end)};function basename(path){if(typeof path!=="string")path=path+"";var start=0;var end=-1;var matchedSlash=true;var i;for(i=path.length-1;i>=0;--i){if(path.charCodeAt(i)===47){if(!matchedSlash){start=i+1;break}}else if(end===-1){matchedSlash=false;end=i+1}}if(end===-1)return"";return path.slice(start,end)}exports.basename=function(path,ext){var f=basename(path);if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){if(typeof path!=="string")path=path+"";var startDot=-1;var startPart=0;var end=-1;var matchedSlash=true;var preDotState=0;for(var i=path.length-1;i>=0;--i){var code=path.charCodeAt(i);if(code===47){if(!matchedSlash){startPart=i+1;break}continue}if(end===-1){matchedSlash=false;end=i+1}if(code===46){if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1}else if(startDot!==-1){preDotState=-1}}if(startDot===-1||end===-1||preDotState===0||preDotState===1&&startDot===end-1&&startDot===startPart+1){return""}return path.slice(startDot,end)};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:5}],5:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],6:[function(require,module,exports){module.exports={name:"ejs",description:"Embedded JavaScript templates",keywords:["template","engine","ejs"],version:"3.1.7",author:"Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)",license:"Apache-2.0",bin:{ejs:"./bin/cli.js"},main:"./lib/ejs.js",jsdelivr:"ejs.min.js",unpkg:"ejs.min.js",repository:{type:"git",url:"git://github.com/mde/ejs.git"},bugs:"https://github.com/mde/ejs/issues",homepage:"https://github.com/mde/ejs",dependencies:{jake:"^10.8.5"},devDependencies:{browserify:"^16.5.1",eslint:"^6.8.0","git-directory-deploy":"^1.5.1",jsdoc:"^3.6.7","lru-cache":"^4.0.1",mocha:"^7.1.1","uglify-js":"^3.3.16"},engines:{node:">=0.10.0"},scripts:{test:"mocha"}}},{}]},{},[1])(1)}); | ... | ... |
... | @@ -25,6 +25,8 @@ | ... | @@ -25,6 +25,8 @@ |
25 | 'use strict'; | 25 | 'use strict'; |
26 | 26 | ||
27 | var regExpChars = /[|\\{}()[\]^$+*?.]/g; | 27 | var regExpChars = /[|\\{}()[\]^$+*?.]/g; |
28 | +var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
29 | +var hasOwn = function (obj, key) { return hasOwnProperty.apply(obj, [key]); }; | ||
28 | 30 | ||
29 | /** | 31 | /** |
30 | * Escape characters reserved in regular expressions. | 32 | * Escape characters reserved in regular expressions. |
... | @@ -116,6 +118,12 @@ exports.shallowCopy = function (to, from) { | ... | @@ -116,6 +118,12 @@ exports.shallowCopy = function (to, from) { |
116 | from = from || {}; | 118 | from = from || {}; |
117 | if ((to !== null) && (to !== undefined)) { | 119 | if ((to !== null) && (to !== undefined)) { |
118 | for (var p in from) { | 120 | for (var p in from) { |
121 | + if (!hasOwn(from, p)) { | ||
122 | + continue; | ||
123 | + } | ||
124 | + if (p === '__proto__' || p === 'constructor') { | ||
125 | + continue; | ||
126 | + } | ||
119 | to[p] = from[p]; | 127 | to[p] = from[p]; |
120 | } | 128 | } |
121 | } | 129 | } |
... | @@ -141,6 +149,12 @@ exports.shallowCopyFromList = function (to, from, list) { | ... | @@ -141,6 +149,12 @@ exports.shallowCopyFromList = function (to, from, list) { |
141 | for (var i = 0; i < list.length; i++) { | 149 | for (var i = 0; i < list.length; i++) { |
142 | var p = list[i]; | 150 | var p = list[i]; |
143 | if (typeof from[p] != 'undefined') { | 151 | if (typeof from[p] != 'undefined') { |
152 | + if (!hasOwn(from, p)) { | ||
153 | + continue; | ||
154 | + } | ||
155 | + if (p === '__proto__' || p === 'constructor') { | ||
156 | + continue; | ||
157 | + } | ||
144 | to[p] = from[p]; | 158 | to[p] = from[p]; |
145 | } | 159 | } |
146 | } | 160 | } | ... | ... |
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | "engine", | 6 | "engine", |
7 | "ejs" | 7 | "ejs" |
8 | ], | 8 | ], |
9 | - "version": "3.1.7", | 9 | + "version": "3.1.8", |
10 | "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", | 10 | "author": "Matthew Eernisse <mde@fleegix.org> (http://fleegix.org)", |
11 | "license": "Apache-2.0", | 11 | "license": "Apache-2.0", |
12 | "bin": { | 12 | "bin": { | ... | ... |
... | @@ -13,10 +13,11 @@ | ... | @@ -13,10 +13,11 @@ |
13 | "bootstrap": "^5.1.3", | 13 | "bootstrap": "^5.1.3", |
14 | "cookie-parser": "^1.4.6", | 14 | "cookie-parser": "^1.4.6", |
15 | "crypto": "^1.0.1", | 15 | "crypto": "^1.0.1", |
16 | - "ejs": "^3.1.7", | 16 | + "ejs": "^3.1.8", |
17 | "express": "^4.18.1", | 17 | "express": "^4.18.1", |
18 | "express-error-handler": "^1.1.0", | 18 | "express-error-handler": "^1.1.0", |
19 | "express-session": "^1.17.3", | 19 | "express-session": "^1.17.3", |
20 | + "html-entities": "^2.3.3", | ||
20 | "http": "^0.0.1-security", | 21 | "http": "^0.0.1-security", |
21 | "mongoose": "^6.3.4", | 22 | "mongoose": "^6.3.4", |
22 | "mysql": "^2.18.1", | 23 | "mysql": "^2.18.1", |
... | @@ -357,9 +358,9 @@ | ... | @@ -357,9 +358,9 @@ |
357 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" | 358 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" |
358 | }, | 359 | }, |
359 | "node_modules/ejs": { | 360 | "node_modules/ejs": { |
360 | - "version": "3.1.7", | 361 | + "version": "3.1.8", |
361 | - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", | 362 | + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", |
362 | - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", | 363 | + "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", |
363 | "dependencies": { | 364 | "dependencies": { |
364 | "jake": "^10.8.5" | 365 | "jake": "^10.8.5" |
365 | }, | 366 | }, |
... | @@ -574,6 +575,11 @@ | ... | @@ -574,6 +575,11 @@ |
574 | "url": "https://github.com/sponsors/ljharb" | 575 | "url": "https://github.com/sponsors/ljharb" |
575 | } | 576 | } |
576 | }, | 577 | }, |
578 | + "node_modules/html-entities": { | ||
579 | + "version": "2.3.3", | ||
580 | + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", | ||
581 | + "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==" | ||
582 | + }, | ||
577 | "node_modules/http": { | 583 | "node_modules/http": { |
578 | "version": "0.0.1-security", | 584 | "version": "0.0.1-security", |
579 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz", | 585 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz", |
... | @@ -1526,9 +1532,9 @@ | ... | @@ -1526,9 +1532,9 @@ |
1526 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" | 1532 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" |
1527 | }, | 1533 | }, |
1528 | "ejs": { | 1534 | "ejs": { |
1529 | - "version": "3.1.7", | 1535 | + "version": "3.1.8", |
1530 | - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.7.tgz", | 1536 | + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.8.tgz", |
1531 | - "integrity": "sha512-BIar7R6abbUxDA3bfXrO4DSgwo8I+fB5/1zgujl3HLLjwd6+9iOnrT+t3grn2qbk9vOgBubXOFwX2m9axoFaGw==", | 1537 | + "integrity": "sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==", |
1532 | "requires": { | 1538 | "requires": { |
1533 | "jake": "^10.8.5" | 1539 | "jake": "^10.8.5" |
1534 | } | 1540 | } |
... | @@ -1699,6 +1705,11 @@ | ... | @@ -1699,6 +1705,11 @@ |
1699 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", | 1705 | "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", |
1700 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" | 1706 | "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" |
1701 | }, | 1707 | }, |
1708 | + "html-entities": { | ||
1709 | + "version": "2.3.3", | ||
1710 | + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.3.3.tgz", | ||
1711 | + "integrity": "sha512-DV5Ln36z34NNTDgnz0EWGBLZENelNAtkiFA4kyNOG2tDI6Mz1uSWiq1wAKdyjnJwyDiDO7Fa2SO1CTxPXL8VxA==" | ||
1712 | + }, | ||
1702 | "http": { | 1713 | "http": { |
1703 | "version": "0.0.1-security", | 1714 | "version": "0.0.1-security", |
1704 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz", | 1715 | "resolved": "https://registry.npmjs.org/http/-/http-0.0.1-security.tgz", | ... | ... |
... | @@ -13,10 +13,11 @@ | ... | @@ -13,10 +13,11 @@ |
13 | "bootstrap": "^5.1.3", | 13 | "bootstrap": "^5.1.3", |
14 | "cookie-parser": "^1.4.6", | 14 | "cookie-parser": "^1.4.6", |
15 | "crypto": "^1.0.1", | 15 | "crypto": "^1.0.1", |
16 | - "ejs": "^3.1.7", | 16 | + "ejs": "^3.1.8", |
17 | "express": "^4.18.1", | 17 | "express": "^4.18.1", |
18 | "express-error-handler": "^1.1.0", | 18 | "express-error-handler": "^1.1.0", |
19 | "express-session": "^1.17.3", | 19 | "express-session": "^1.17.3", |
20 | + "html-entities": "^2.3.3", | ||
20 | "http": "^0.0.1-security", | 21 | "http": "^0.0.1-security", |
21 | "mongoose": "^6.3.4", | 22 | "mongoose": "^6.3.4", |
22 | "mysql": "^2.18.1", | 23 | "mysql": "^2.18.1", | ... | ... |
-
Please register or login to post a comment