Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Views
import AppWrapper from '../AppWrapper'
// require('!style-loader!css-loader!normalize.css')
// require('bootstrap/less/bootstrap')
// require('styles/main')
const createdMuiTheme = createMuiTheme(FirstVoicesTheme)
const context = {
providedState: {
properties: {
title: ConfGlobal.title,
pageTitleParams: null,
domain: ConfGlobal.domain,
},
},
}
describe('AppWrapper', () => {
test('Mounts', () => {
// Structure: Arrange
const container = document.createElement('div')
ReactDOM.render(
,
container)
expect(container.querySelector('#pageNavigation').textContent).toMatch('EXPLORE LANGUAGES')
import { FirstVoicesThemeV1 as FirstVoicesTheme } from 'views/themes/FirstVoicesTheme.js'
import ConfGlobal from 'conf/local.js'
// Views
import AppWrapper from '../AppWrapper'
// require('!style-loader!css-loader!normalize.css')
// require('bootstrap/less/bootstrap')
// require('styles/main')
const createdMuiTheme = createMuiTheme(FirstVoicesTheme)
const context = {
providedState: {
properties: {
title: ConfGlobal.title,
pageTitleParams: null,
domain: ConfGlobal.domain,
},
},
}
describe('AppWrapper', () => {
test('Mounts', () => {
// Structure: Arrange
const container = document.createElement('div')
ReactDOM.render(
,
container)
return async function () {
const conf = path.format({ dir, base: `${base}.config.js` });
let { config, client, clients } = require(conf); // eslint-disable-line
if (client && !clients) {
clients = [client];
}
if (!config.findAccount) {
config.findAccount = Account.findAccount;
}
const issuerIdentifier = `${protocol}//127.0.0.1:${port}`;
const provider = new Provider(issuerIdentifier, {
clients,
jwks: global.keystore.toJWKS(true),
adapter: TestAdapter,
...config,
});
let agent;
function logout() {
const expire = new Date(0);
return async function () {
const conf = path.format({ dir, base: `${base}.config.js` });
let { config, client, clients } = require(conf); // eslint-disable-line
if (client && !clients) {
clients = [client];
}
if (!config.findAccount) {
config.findAccount = Account.findAccount;
}
const issuerIdentifier = `${protocol}//127.0.0.1:${port}`;
const provider = new Provider(issuerIdentifier, {
clients,
jwks: global.keystore.toJWKS(true),
adapter: TestAdapter,
...config,
});
let agent;
function logout() {
const expire = new Date(0);
const cookies = [
$('#html_upload_form')
.attr('action', '/addhtml/' + Files.currentEnsemble)
.submit()[0]
.reset();
} else if (getUploadType() === 'youtube') {
console.log('YouTube Upload');
$('#youtube_upload_form')
.attr('action', '/addyoutube/' + Files.currentEnsemble)
.submit()[0]
.reset();
} else {
console.log('File Upload');
// we need a way to pass the id_ensemble and id_folder: we do it in the URL
var folder_fragment = (Files.currentFolder === null) ? '' : '&id_folder=' + Files.currentFolder;
var newauth = ('ckey' in Conf.userinfo) ? '&ckey=' + Conf.userinfo.ckey : '';
$('#file_upload_form')
.attr('action', Conf.servers.upload + '/pdf3/upload?id_ensemble=' + Files.currentEnsemble + '&id_source=' + payload.id_source + folder_fragment + newauth)
.submit()[0]
.reset();
//$.I("File added to remote repository");
}
$('#add_file_dialog').dialog('destroy');
//SACHA TODO: Fix this when we setup connectionIds
window.setTimeout(function () {
//NOTE (important !)
$.I('NB is processing your file... You should receive an email once your file is available on NB.');
var payload_objects = { types:['files'], id: payload.id_source };
if ('id_ensemble' in Pers.params) {
if (x.status.errno) {
//just display that there was an error for now
if (errback !== undefined) {
errback(x.status, x.payload);
}
$.L(x.status.msg);
return;
}
// console.log("cb w/ x=", x);
callback(x.payload);
};
var auth_str = Conf.userinfo.guest ? 'guest=1' : 'ckey=' + Conf.userinfo.ckey;
$.post(Conf.servers.rpc + '/pdf4/rpc?' + auth_str, { cid: Pers.connection_id, f: fctname, a: JSON.stringify(dict) }, cb, 'json');
};
if (x.status.errno) {
//just display that there was an error for now
if (errback !== undefined) {
errback(x.status, x.payload);
}
$.L(x.status.msg);
return;
}
// console.log("cb w/ x=", x);
callback(x.payload);
};
var auth_str = Conf.userinfo.guest ? 'guest=1' : 'ckey=' + Conf.userinfo.ckey;
$.post(Conf.servers.rpc + '/pdf4/rpc?' + auth_str, { cid: Pers.connection_id, f: fctname, a: JSON.stringify(dict) }, cb, 'json');
};
/* Image viewer window - remote (data) part */
import * as conf from "conf.js";
import { CHILDREN, READ } from "path/path.js";
const remote = require("electron").remote;
const windowOptions = {
center: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export function match(path) {
let ext = path.toString().split(".").pop();
if (!ext) { return; }
return ext.match(/jpe?g|gif|png|svg|bmp|ico/i);
}
export async function view(path, list) {
let [width, height] = remote.getCurrentWindow().getSize();
let currentOptions = { title: path.toString(), width, height };
let options = Object.assign({}, windowOptions, currentOptions);
let window = new remote.BrowserWindow(options);
window.setMenu(null);
/* Audio/Video viewer window - remote (data) part */
import * as conf from "conf.js";
const remote = require("electron").remote;
const audio = /(ogg|mp3|wav|m4a)$/i;
const video = /(mpe?g|mkv|webm|mov|mp4)$/i;
const windowOptions = {
center: true,
backgroundColor: conf.background,
webPreferences: { nodeIntegration: true }
}
export function match(path) {
let ext = path.toString().split(".").pop();
return ext.match(audio) || ext.match(video);
}
export function view(path, list) {
let [width, height] = remote.getCurrentWindow().getSize();
let currentOptions = { title: path.toString(), width, height };
let options = Object.assign({}, windowOptions, currentOptions);
let window = new remote.BrowserWindow(options);
window.setMenu(null);
window.loadURL(`file://${__dirname}/../viewer/av/index.html`);
_getInitialState() {
let routes = Immutable.fromJS(ConfRoutes)
const contextPath = ConfGlobal.contextPath.split('/').filter((v) => v !== '')
// Add context path to PATH and ALIAS properties if it is set (usually applies in DEV environment)
if (contextPath && contextPath.length > 0) {
routes = routes.map((route) => {
let newRoute = route.set('path', List(contextPath).concat(route.get('path')))
newRoute = newRoute.set('alias', List(contextPath).concat(route.get('alias')))
return newRoute
})
}
return {
routes,
warningsDismissed: false,
}
}