Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Provider } from 'react-redux';
import { get, some } from 'lodash';
import '../scss/style.scss';
import { content as welcomeMessage } from './welcome-message';
import appState from './flux/app-state';
import isDevConfig from './utils/is-dev-config';
import { normalizeForSorting } from './utils/note-utils';
const { newNote } = appState.actionCreators;
const config = getConfig();
const cookie = parse(document.cookie);
const auth = new Auth(config.app_id, config.app_key);
const appProvider = 'simplenote.com';
const appID = config.app_id;
let token = cookie.token || localStorage.access_token;
// Signs out the user from app engine and redirects to signin page
const redirectToWebSigninIfNecessary = () => {
if (!config.is_app_engine) {
return;
}
if (window.webConfig && window.webConfig.signout) {
window.webConfig.signout(function() {
window.location = `${config.app_engine_url}/`;
});
}
import { Provider } from 'react-redux';
import { get, some } from 'lodash';
import '../scss/style.scss';
import { content as welcomeMessage } from './welcome-message';
import appState from './flux/app-state';
import isDevConfig from './utils/is-dev-config';
import { normalizeForSorting } from './utils/note-utils';
const { newNote } = appState.actionCreators;
const config = getConfig();
const cookie = parse(document.cookie);
const auth = new Auth(config.app_id, config.app_key);
const appProvider = 'simplenote.com';
const appID = config.app_id;
let token = cookie.token || localStorage.access_token;
// Redirect to web sign in if running on App Engine
if (!token && config.is_app_engine) {
window.location = `${config.app_engine_url}/login/`;
}
const client = initClient({
appID,
token,
bucketConfig: {
note: {
beforeIndex: function(note) {
import simperium, { Client } from 'simperium';
import store_provider from './store-provider';
import ghost_store from './ghost-store';
import localQueueStore from './local-queue-store';
import util from 'util';
import events from 'events';
export const Auth = simperium.Auth;
export default function(settings) {
const browserClient = new BrowserClient(settings);
window.addEventListener('beforeunload', () => {
Object.values(browserClient.buckets).forEach(localQueueStore.persist);
});
return browserClient;
}
Client.Bucket.prototype.query = function(fn) {
this.store.setup.then(fn);
};
function BrowserClient({ appID, token, bucketConfig, database, version }) {