mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-11-08 23:25:51 +01:00
commit
d824821b7a
@ -4,8 +4,4 @@ node_js:
|
||||
- '6'
|
||||
- '7'
|
||||
sudo: false
|
||||
matrix:
|
||||
allow_failures:
|
||||
- node_js: 'iojs'
|
||||
fast_finish: true
|
||||
script: npm install . && npm run test-travis
|
||||
script: npm install . && npm run test-travis
|
||||
|
@ -126,7 +126,7 @@
|
||||
display: none;
|
||||
}
|
||||
|
||||
.packages-container {
|
||||
.pkg-search-container {
|
||||
.search-ajax {
|
||||
display: block;
|
||||
margin: 50px auto;
|
||||
|
@ -8,7 +8,10 @@
|
||||
</div>
|
||||
<div class="col-md-4 col-sm-4">
|
||||
<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>
|
||||
|
@ -9,7 +9,7 @@ $(function() {
|
||||
var $pkgListing = $('#all-packages')
|
||||
var $searchBtn = $('.js-search-btn')
|
||||
var request
|
||||
var currentResults
|
||||
var lastQuery = ''
|
||||
|
||||
var toggle = function(validQuery) {
|
||||
$searchResults.toggleClass('show', validQuery)
|
||||
@ -20,21 +20,20 @@ $(function() {
|
||||
}
|
||||
|
||||
$form.bind('submit keyup', function(e) {
|
||||
var q, qBool
|
||||
var query, isValidQuery
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
q = $input.val()
|
||||
qBool = (q !== '')
|
||||
query = $input.val()
|
||||
isValidQuery = (query !== '')
|
||||
|
||||
toggle(qBool)
|
||||
toggle(isValidQuery)
|
||||
|
||||
if (!qBool) {
|
||||
if (!isValidQuery) {
|
||||
if (request && typeof request.abort === 'function') {
|
||||
request.abort()
|
||||
}
|
||||
|
||||
currentResults = null
|
||||
$searchResults.html('')
|
||||
return
|
||||
}
|
||||
@ -43,14 +42,13 @@ $(function() {
|
||||
request.abort()
|
||||
}
|
||||
|
||||
if (!currentResults) {
|
||||
if (query !== lastQuery) {
|
||||
lastQuery = query
|
||||
$searchResults.html(
|
||||
"<img class='search-ajax' src='-/static/ajax.gif' alt='Spinner'/>")
|
||||
}
|
||||
|
||||
request = $.getJSON('-/search/' + q, function( results ) {
|
||||
currentResults = results
|
||||
|
||||
request = $.getJSON('-/search/' + query, function( results ) {
|
||||
if (results.length > 0) {
|
||||
var html = ''
|
||||
|
||||
@ -63,6 +61,9 @@ $(function() {
|
||||
$searchResults.html(
|
||||
"<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
|
||||
secureOptions: constants.SSL_OP_NO_SSLv2 | constants.SSL_OP_NO_SSLv3,
|
||||
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)
|
||||
} catch (err) { // catch errors related to certificate loading
|
||||
logger.logger.fatal({ err: err }, 'cannot create server: @{err.message}')
|
||||
|
@ -133,7 +133,11 @@ module.exports = function(config, auth, storage) {
|
||||
var getData = function(i) {
|
||||
storage.get_package(results[i].ref, function(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) {
|
||||
|
@ -18,7 +18,7 @@ function tempFile(str) {
|
||||
|
||||
function renameTmp(src, dst, _cb) {
|
||||
function cb(err) {
|
||||
if (err) fs.unlink(src)
|
||||
if (err) fs.unlink(src, function() {})
|
||||
_cb(err)
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ function renameTmp(src, dst, _cb) {
|
||||
var tmp = tempFile(dst)
|
||||
fs.rename(dst, tmp, function(err) {
|
||||
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
|
||||
|
||||
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) {
|
||||
storages[self.config.packages[pkg].storage] = true
|
||||
}
|
||||
@ -604,7 +604,7 @@ Storage.prototype.search = function(startkey, options) {
|
||||
description : data.versions[latest].description,
|
||||
'dist-tags' : { latest: latest },
|
||||
maintainers : data.versions[latest].maintainers ||
|
||||
[ data.versions[latest]._npmUser ].filter(Boolean),
|
||||
[ data.versions[latest].author ].filter(Boolean),
|
||||
author : data.versions[latest].author,
|
||||
repository : data.versions[latest].repository,
|
||||
readmeFilename : data.versions[latest].readmeFilename || '',
|
||||
|
@ -80,11 +80,11 @@ module.exports.allow = function(auth) {
|
||||
return function(action) {
|
||||
return function(req, res, next) {
|
||||
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();
|
||||
if (error) {
|
||||
next(error)
|
||||
} else if (is_allowed) {
|
||||
} else if (allowed) {
|
||||
next()
|
||||
} else {
|
||||
// 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,
|
||||
.coffeescript .hljs-property,
|
||||
.hljs-phony {
|
||||
color: #8888ff;
|
||||
color: #88F;
|
||||
}
|
||||
.hljs-keyword,
|
||||
.hljs-id,
|
||||
@ -7233,7 +7233,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
||||
padding: 0;
|
||||
}
|
||||
.body .main-header {
|
||||
background: #ffffff;
|
||||
background: #fff;
|
||||
}
|
||||
.body .main-header .navbar {
|
||||
margin-bottom: 0;
|
||||
@ -7284,7 +7284,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
||||
border-bottom: none;
|
||||
}
|
||||
.body .content .entry:nth-child( even ) {
|
||||
background: #f3f3f3;
|
||||
background: #F3F3F3;
|
||||
}
|
||||
.body .content .entry .title {
|
||||
margin: 0 0 5px 10px;
|
||||
@ -7321,7 +7321,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
||||
.body .content .entry .readme {
|
||||
font-size: 14px;
|
||||
margin-top: 10px;
|
||||
background: #ffffff;
|
||||
background: #fff;
|
||||
padding: 10px 12px;
|
||||
-webkit-border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
@ -7331,7 +7331,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
||||
.pkg-search-container {
|
||||
display: none;
|
||||
}
|
||||
.packages-container .search-ajax {
|
||||
.pkg-search-container .search-ajax {
|
||||
display: block;
|
||||
margin: 50px auto;
|
||||
}
|
||||
@ -7354,7 +7354,7 @@ Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiac
|
||||
color: #d6645c;
|
||||
}
|
||||
.white {
|
||||
color: #ffffff !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
.red-bg {
|
||||
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: {
|
||||
name: 'test_user',
|
||||
}
|
||||
},
|
||||
}
|
||||
]
|
||||
|
||||
describe('search', function() {
|
||||
@ -44,7 +44,7 @@ describe('search', function() {
|
||||
it('search query item', function() {
|
||||
var result = Search.query('t');
|
||||
assert(result.length === 3);
|
||||
})
|
||||
});
|
||||
|
||||
it('search remove item', function() {
|
||||
var item = {
|
||||
@ -60,7 +60,6 @@ describe('search', function() {
|
||||
Search.remove(item.name);
|
||||
var result = Search.query('test6');
|
||||
assert(result.length === 0);
|
||||
})
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user