Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,14 @@ app.get('/libs/:username/:scriptname', script.lib(script.view));
app.get('/lib/:scriptname/edit', script.lib(script.edit));
app.post('/lib/:scriptname/edit', script.lib(script.edit));
app.get('/libs/:username/:scriptname/source', script.lib(user.editScript));
app.get('/libs/src/:username/:scriptname', scriptStorage.sendScript);
app.get('/vote/libs/:username/:scriptname/:vote', script.lib(script.vote));
//app.get(listRegex('\/use\/lib\/([^\/]+?)\/([^\/]+?)', 'script'), script.useLib);

// Raw source
app.get('/src/:type(scripts|libs)/:username/:scriptname',
scriptStorage.sendScript);
app.get('/libs/src/:username/:scriptname', scriptStorage.sendScript); // Legacy

// Issues routes
app_route('/:type(scripts|libs)/:username/:namespace?/:scriptname/issues/:open(closed)?').get(issue.list);
//app_route('/:type(scripts|libs)/:username/:namespace?/:scriptname/issues/:topic').get(issue.view);
Expand Down
6 changes: 3 additions & 3 deletions controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ exports.sendScript = function (req, res, next) {
res.set('Content-Type', 'text/javascript; charset=utf-8');
stream.pipe(res);

// Don't count installs on libraries
if (script.isLib) { return; }
// Don't count installs on raw source route
if (script.isLib || req.route.params.type) { return; }

// Update the install count
++script.installs;
Expand Down Expand Up @@ -232,7 +232,7 @@ exports.storeScript = function (user, meta, buf, callback, update) {
var libraryRegex = new RegExp('^https?:\/\/' +
(process.env.NODE_ENV === 'production' ?
'openuserjs\.org' : 'localhost:8080') +
'\/libs\/src\/(.+?\/.+?\.js)$', '');
'\/(?:libs\/src|src\/libs)\/(.+?\/.+?\.js)$', '');

if (!meta) { return callback(null); }

Expand Down
2 changes: 1 addition & 1 deletion libs/modelParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ var getScriptEditSourcePageUrl = function (script) {

var getScriptInstallPageUrl = function (script) {
var isLib = script.isLib || false;
return (isLib ? '/libs/src/' : '/install/') + script.installName;
return (isLib ? '/src/libs/' : '/install/') + script.installName;
};

//
Expand Down