Skip to content

Commit 0e053a1

Browse files
committed
update search configs
1 parent fa16052 commit 0e053a1

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

api/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ app.get('/status', function(req, res) {
2424
});
2525

2626
app.get('/', function(req, res) {
27-
if (!req.headers.referer || req.headers.referer.indexOf('oi-wiki.org') < 0) {
28-
res.send([]);
29-
return;
30-
}
27+
// if (!req.headers.referer || req.headers.referer.indexOf('oi-wiki.org') < 0) {
28+
// res.send([]);
29+
//return;
30+
//}
3131
// console.log(req.headers);
3232
if (!req.query.s) {
3333
res.send([]);
@@ -117,3 +117,4 @@ app.get('/', function(req, res) {
117117
app.listen(app.get('port'), function() {
118118
console.log('Search server running on port ' + app.get('port'));
119119
});
120+

webhook/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ function getContent(e) {
2424
}
2525
lines = file.split('\n');
2626
let h1reg = /^# .+$/gm, h2reg = /^## .+$/gm, authorreg = /author:[^\n]*/gm;
27-
lines = lines.filter((e) => {return !e.match(authorreg));
28-
others = lines.filter((e) => {return !e.match(h1reg) && !e.match(h2reg));
27+
lines = lines.filter((e) => {return !e.match(authorreg)});
28+
others = lines.filter((e) => {return !e.match(h1reg) && !e.match(h2reg)});
2929
let title = lines[0];
3030
let filename = e.replace('docs/', '');
3131
if (!title.match(h1reg)) {
@@ -147,3 +147,4 @@ console.log(event.payload.ref);
147147
}
148148
});
149149
})
150+

webhook/init.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
const fs = require("fs");
23
let remark = require("remark");
34
const strip = require("strip-markdown-math");
@@ -12,8 +13,8 @@ var client = new elasticsearch.Client({
1213
log: "trace"
1314
});
1415

15-
// modified = String(fs.readFileSync('/home/ubuntu/OI-wiki/mkdocs.yml')).split('\n').filter((e => {return e.match(/md$/)})).map(e =>'docs/' + e.split(':')[1].slice(1));
16-
modified = String(fs.readFileSync('/home/ubuntu/OI-wiki/mkdocs.yml')).split('\n').slice(100, 300).filter((e => {return e.match(/md$/)})).map(e =>'docs/' + e.split(':')[1].slice(1));
16+
modified = String(fs.readFileSync('/home/ubuntu/OI-wiki/mkdocs.yml')).split('\n').filter((e => {return e.match(/md$/)})).map(e =>'docs/' + e.split(':')[1].slice(1));
17+
// modified = String(fs.readFileSync('/home/ubuntu/OI-wiki/mkdocs.yml')).split('\n').slice(100, 300).filter((e => {return e.match(/md$/)})).map(e =>'docs/' + e.split(':')[1].slice(1));
1718

1819
let ops = [],
1920
yml = "";

webhook/test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ const response = client.search({
6363
}
6464
}
6565
});
66+

0 commit comments

Comments
 (0)