mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-13 03:35:52 +01:00
commit
d824821b7a
@ -4,8 +4,4 @@ node_js:
|
|||||||
- '6'
|
- '6'
|
||||||
- '7'
|
- '7'
|
||||||
sudo: false
|
sudo: false
|
||||||
matrix:
|
script: npm install . && npm run test-travis
|
||||||
allow_failures:
|
|
||||||
- node_js: 'iojs'
|
|
||||||
fast_finish: true
|
|
||||||
script: npm install . && npm run test-travis
|
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.packages-container {
|
.pkg-search-container {
|
||||||
.search-ajax {
|
.search-ajax {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 50px auto;
|
margin: 50px auto;
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-sm-4">
|
<div class="col-md-4 col-sm-4">
|
||||||
<div class="author pull-right">
|
<div class="author pull-right">
|
||||||
<small>By: {{ author.name }}</small>
|
{{!-- I can't make hbs helper work without break code style --}}
|
||||||
|
{{#with author}}
|
||||||
|
<small>By: {{{ name }}}</small>
|
||||||
|
{{/with}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,7 +9,7 @@ $(function() {
|
|||||||
var $pkgListing = $('#all-packages')
|
var $pkgListing = $('#all-packages')
|
||||||
var $searchBtn = $('.js-search-btn')
|
var $searchBtn = $('.js-search-btn')
|
||||||
var request
|
var request
|
||||||
var currentResults
|
var lastQuery = ''
|
||||||
|
|
||||||
var toggle = function(validQuery) {
|
var toggle = function(validQuery) {
|
||||||
$searchResults.toggleClass('show', validQuery)
|
$searchResults.toggleClass('show', validQuery)
|
||||||
@ -20,21 +20,20 @@ $(function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form.bind('submit keyup', function(e) {
|
$form.bind('submit keyup', function(e) {
|
||||||
var q, qBool
|
var query, isValidQuery
|
||||||
|
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
q = $input.val()
|
query = $input.val()
|
||||||
qBool = (q !== '')
|
isValidQuery = (query !== '')
|
||||||
|
|
||||||
toggle(qBool)
|
toggle(isValidQuery)
|
||||||
|
|
||||||
if (!qBool) {
|
if (!isValidQuery) {
|
||||||
if (request && typeof request.abort === 'function') {
|
if (request && typeof request.abort === 'function') {
|
||||||
request.abort()
|
request.abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
currentResults = null
|
|
||||||
$searchResults.html('')
|
$searchResults.html('')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -43,14 +42,13 @@ $(function() {
|
|||||||
request.abort()
|
request.abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!currentResults) {
|
if (query !== lastQuery) {
|
||||||
|
lastQuery = query
|
||||||
$searchResults.html(
|
$searchResults.html(
|
||||||
"<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>")
|
"<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>")
|
||||||
}
|
}
|
||||||
|
|
||||||
request = $.getJSON('-/search/' + q, function( results ) {
|
request = $.getJSON('-/search/' + query, function( results ) {
|
||||||
currentResults = results
|
|
||||||
|
|
||||||
if (results.length > 0) {
|
if (results.length > 0) {
|
||||||
var html = ''
|
var html = ''
|
||||||
|
|
||||||
@ -63,6 +61,9 @@ $(function() {
|
|||||||
$searchResults.html(
|
$searchResults.html(
|
||||||
"<div class='no-results'><big>No Results</big></div>")
|
"<div class='no-results'><big>No Results</big></div>")
|
||||||
}
|
}
|
||||||
|
}).fail(function () {
|
||||||
|
$searchResults.html(
|
||||||
|
"<div class='no-results'><big>No Results</big></div>")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -132,7 +132,9 @@ function afterConfigLoad() {
|
|||||||
secureProtocol: 'SSLv23_method', // disable insecure SSLv2 and SSLv3
|
secureProtocol: 'SSLv23_method', // disable insecure SSLv2 and SSLv3
|
||||||
secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3,
|
secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3,
|
||||||
key: fs.readFileSync(config.https.key),
|
key: fs.readFileSync(config.https.key),
|
||||||
cert: fs.readFileSync(config.https.cert)
|
cert: fs.readFileSync(config.https.cert),
|
||||||
|
ca: fs.readFileSync(config.https.ca)
|
||||||
|
|
||||||
}, app)
|
}, app)
|
||||||
} catch (err) { // catch errors related to certificate loading
|
} catch (err) { // catch errors related to certificate loading
|
||||||
logger.logger.fatal({ err: err }, 'cannot create server: @{err.message}')
|
logger.logger.fatal({ err: err }, 'cannot create server: @{err.message}')
|
||||||
|
@ -133,7 +133,11 @@ module.exports = function(config, auth, storage) {
|
|||||||
var getData = function(i) {
|
var getData = function(i) {
|
||||||
storage.get_package(results[i].ref, function(err, entry) {
|
storage.get_package(results[i].ref, function(err, entry) {
|
||||||
if (!err && entry) {
|
if (!err && entry) {
|
||||||
packages.push(entry.versions[entry['dist-tags'].latest])
|
auth.allow_access(entry.name, req.remote_user, function(err, allowed) { // TODO: This may cause performance issue?
|
||||||
|
if (err || !allowed) return
|
||||||
|
|
||||||
|
packages.push(entry.versions[entry['dist-tags'].latest])
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i >= results.length - 1) {
|
if (i >= results.length - 1) {
|
||||||
|
@ -18,7 +18,7 @@ function tempFile(str) {
|
|||||||
|
|
||||||
function renameTmp(src, dst, _cb) {
|
function renameTmp(src, dst, _cb) {
|
||||||
function cb(err) {
|
function cb(err) {
|
||||||
if (err) fs.unlink(src)
|
if (err) fs.unlink(src, function() {})
|
||||||
_cb(err)
|
_cb(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ function renameTmp(src, dst, _cb) {
|
|||||||
var tmp = tempFile(dst)
|
var tmp = tempFile(dst)
|
||||||
fs.rename(dst, tmp, function(err) {
|
fs.rename(dst, tmp, function(err) {
|
||||||
fs.rename(src, dst, cb)
|
fs.rename(src, dst, cb)
|
||||||
if (!err) fs.unlink(tmp)
|
if (!err) fs.unlink(tmp, function () {})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +480,7 @@ Storage.prototype._each_package = function (on_package, on_end) {
|
|||||||
storages[self.config.storage] = true
|
storages[self.config.storage] = true
|
||||||
|
|
||||||
if (self.config.packages) {
|
if (self.config.packages) {
|
||||||
Object.keys(self.packages || {}).map(function (pkg) {
|
Object.keys(self.config.packages || {}).map(function (pkg) {
|
||||||
if (self.config.packages[pkg].storage) {
|
if (self.config.packages[pkg].storage) {
|
||||||
storages[self.config.packages[pkg].storage] = true
|
storages[self.config.packages[pkg].storage] = true
|
||||||
}
|
}
|
||||||
@ -604,7 +604,7 @@ Storage.prototype.search = function(startkey, options) {
|
|||||||
description : data.versions[latest].description,
|
description : data.versions[latest].description,
|
||||||
'dist-tags' : { latest: latest },
|
'dist-tags' : { latest: latest },
|
||||||
maintainers : data.versions[latest].maintainers ||
|
maintainers : data.versions[latest].maintainers ||
|
||||||
[ data.versions[latest]._npmUser ].filter(Boolean),
|
[ data.versions[latest].author ].filter(Boolean),
|
||||||
author : data.versions[latest].author,
|
author : data.versions[latest].author,
|
||||||
repository : data.versions[latest].repository,
|
repository : data.versions[latest].repository,
|
||||||
readmeFilename : data.versions[latest].readmeFilename || '',
|
readmeFilename : data.versions[latest].readmeFilename || '',
|
||||||
|
@ -80,11 +80,11 @@ module.exports.allow = function(auth) {
|
|||||||
return function(action) {
|
return function(action) {
|
||||||
return function(req, res, next) {
|
return function(req, res, next) {
|
||||||
req.pause();
|
req.pause();
|
||||||
auth['allow_'+action](req.params.package, req.remote_user, function(error, is_allowed) {
|
auth['allow_'+action](req.params.package, req.remote_user, function(error, allowed) {
|
||||||
req.resume();
|
req.resume();
|
||||||
if (error) {
|
if (error) {
|
||||||
next(error)
|
next(error)
|
||||||
} else if (is_allowed) {
|
} else if (allowed) {
|
||||||
next()
|
next()
|
||||||
} else {
|
} else {
|
||||||
// last plugin (that's our built-in one) returns either
|
// last plugin (that's our built-in one) returns either
|
||||||
|
@ -7124,7 +7124,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
|||||||
.lasso .hljs-attribute,
|
.lasso .hljs-attribute,
|
||||||
.coffeescript .hljs-property,
|
.coffeescript .hljs-property,
|
||||||
.hljs-phony {
|
.hljs-phony {
|
||||||
color: #8888ff;
|
color: #88F;
|
||||||
}
|
}
|
||||||
.hljs-keyword,
|
.hljs-keyword,
|
||||||
.hljs-id,
|
.hljs-id,
|
||||||
@ -7233,7 +7233,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
.body .main-header {
|
.body .main-header {
|
||||||
background: #ffffff;
|
background: #fff;
|
||||||
}
|
}
|
||||||
.body .main-header .navbar {
|
.body .main-header .navbar {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@ -7284,7 +7284,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
.body .content .entry:nth-child( even ) {
|
.body .content .entry:nth-child( even ) {
|
||||||
background: #f3f3f3;
|
background: #F3F3F3;
|
||||||
}
|
}
|
||||||
.body .content .entry .title {
|
.body .content .entry .title {
|
||||||
margin: 0 0 5px 10px;
|
margin: 0 0 5px 10px;
|
||||||
@ -7321,7 +7321,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
|||||||
.body .content .entry .readme {
|
.body .content .entry .readme {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
background: #ffffff;
|
background: #fff;
|
||||||
padding: 10px 12px;
|
padding: 10px 12px;
|
||||||
-webkit-border-radius: 3px;
|
-webkit-border-radius: 3px;
|
||||||
-moz-border-radius: 3px;
|
-moz-border-radius: 3px;
|
||||||
@ -7331,7 +7331,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
|||||||
.pkg-search-container {
|
.pkg-search-container {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.packages-container .search-ajax {
|
.pkg-search-container .search-ajax {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 50px auto;
|
margin: 50px auto;
|
||||||
}
|
}
|
||||||
@ -7354,7 +7354,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
|||||||
color: #d6645c;
|
color: #d6645c;
|
||||||
}
|
}
|
||||||
.white {
|
.white {
|
||||||
color: #ffffff !important;
|
color: #fff !important;
|
||||||
}
|
}
|
||||||
.red-bg {
|
.red-bg {
|
||||||
background: #cc3d33;
|
background: #cc3d33;
|
||||||
|
1115
lib/static/main.js
1115
lib/static/main.js
File diff suppressed because it is too large
Load Diff
@ -27,7 +27,7 @@ var packages = [
|
|||||||
_npmUser: {
|
_npmUser: {
|
||||||
name: 'test_user',
|
name: 'test_user',
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
describe('search', function() {
|
describe('search', function() {
|
||||||
@ -44,7 +44,7 @@ describe('search', function() {
|
|||||||
it('search query item', function() {
|
it('search query item', function() {
|
||||||
var result = Search.query('t');
|
var result = Search.query('t');
|
||||||
assert(result.length === 3);
|
assert(result.length === 3);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('search remove item', function() {
|
it('search remove item', function() {
|
||||||
var item = {
|
var item = {
|
||||||
@ -60,7 +60,6 @@ describe('search', function() {
|
|||||||
Search.remove(item.name);
|
Search.remove(item.name);
|
||||||
var result = Search.query('test6');
|
var result = Search.query('test6');
|
||||||
assert(result.length === 0);
|
assert(result.length === 0);
|
||||||
})
|
});
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user