merged upstream develop

This commit is contained in:
Wikinaut 2012-12-07 08:59:13 +01:00
commit 5bf79971b8
20 changed files with 246 additions and 196 deletions

View file

@ -66,8 +66,6 @@ exports.restartServer = function () {
} else {
console.log( "SSL -- not enabled!" );
var http = require('http');
server = http.createServer(app);
}

View file

@ -28,12 +28,6 @@ exports.expressCreateServer = function (hook_name, args, cb) {
//handle import requests
args.app.post('/p/:pad/import', function(req, res, next) {
//if abiword is disabled, skip handling this request
if(settings.abiword == null) {
next();
return;
}
hasPadAccess(req, res, function() {
importHandler.doImport(req, res, req.params.pad);
});

View file

@ -15,8 +15,8 @@ exports.basicAuth = function (req, res, next) {
}
var authorize = function (cb) {
// Do not require auth for static paths...this could be a bit brittle
if (req.path.match(/^\/(static|javascripts|pluginfw)/)) return cb(true);
// Do not require auth for static paths and the API...this could be a bit brittle
if (req.path.match(/^\/(static|javascripts|pluginfw|api)/)) return cb(true);
if (req.path.indexOf('/admin') != 0) {
if (!settings.requireAuthentication) return cb(true);

View file

@ -1,4 +1,4 @@
var languages = require('languages')
var languages = require('languages4translatewiki')
, fs = require('fs')
, path = require('path')
, express = require('express')
@ -8,22 +8,23 @@ var localesPath = __dirname+"/../../locales";
// Serve English strings directly with /locales.ini
var localeIndex = fs.readFileSync(localesPath+'/en.ini')+'\r\n';
// add language base 'en' to availableLangs
exports.availableLangs = {en: languages.getLanguageInfo('en')}
exports.availableLangs = {'en': {'nativeName': 'English', 'direction': 'ltr'}};
fs.readdir(localesPath, function(er, files) {
files.forEach(function(locale) {
locale = locale.split('.')[0]
if(locale.toLowerCase() == 'en') return;
var ext = path.extname(locale);
locale = path.basename(locale, ext).toLowerCase();
if(locale == 'en' || ext != '.ini') return;
// build locale index
localeIndex += '['+locale+']\r\n@import url(locales/'+locale+'.ini)\r\n'
// add info language {name, nativeName, direction} to availableLangs
// add info language {nativeName, direction} to availableLangs
exports.availableLangs[locale]=languages.getLanguageInfo(locale);
})
})
exports.expressCreateServer = function(n, args) {
args.app.use('/locales', express.static(localesPath));