<commit_before>import Vue from 'vue';
import axios from 'axios';

const cookieparser = process.server ? require('cookie-parser') : null;

export const state = () => ({
	loggedIn: false,
	user: null,
	token: null,
	config: null
});

/* eslint-disable no-shadow */
export const mutations = {
	loggedIn(state, payload) {
		state.loggedIn = payload;
	},
	user(state, payload) {
		if (!payload) {
			state.user = {};
			localStorage.removeItem('lolisafe-user');
			return;
		}
		localStorage.setItem('lolisafe-user', JSON.stringify(payload));
		state.user = payload;
	},
	token(state, payload) {
		if (!payload) {
			localStorage.removeItem('lolisafe-token');
			state.token = null;
			return;
		}
		localStorage.setItem('lolisafe-token', payload);
		setAuthorizationHeader(payload);
		state.token = payload;
	},
	config(state, payload) {
		state.config = payload;
	}
};

export const actions = {
	async nuxtServerInit({ commit }, { req }) {
		commit('config', {
			version: process.env.npm_package_version,
			URL: process.env.DOMAIN,
			baseURL: `${process.env.DOMAIN}${process.env.ROUTE_PREFIX}`,
			serviceName: process.env.SERVICE_NAME,
			maxFileSize: parseInt(process.env.MAX_SIZE, 10),
			chunkSize: parseInt(process.env.CHUNK_SIZE, 10),
			maxLinksPerAlbum: parseInt(process.env.MAX_LINKS_PER_ALBUM, 10),
			publicMode: process.env.PUBLIC_MODE == 'true' ? true : false,
			enableAccounts: process.env.USER_ACCOUNTS == 'true' ? true : false
		});

		let token = null;
		if (req.headers.cookie) {
			try {
				token = cookieparser.parse(req.headers.cookie).token;
				commit('loggedIn', true);<commit_msg>No need for this<commit_after>import Vue from 'vue';
import axios from 'axios';

const cookieparser = process.server ? require('cookie-parser') : null;

export const state = () => ({
	loggedIn: false,
	user: null,
	token: null,
	config: null
});

/* eslint-disable no-shadow */
export const mutations = {
	loggedIn(state, payload) {
		state.loggedIn = payload;
	},
	user(state, payload) {
		if (!payload) {
			state.user = null;
			return;
		}
		state.user = payload;
	},
	token(state, payload) {
		if (!payload) {
			state.token = null;
			return;
		}
		setAuthorizationHeader(payload);
		state.token = payload;
	},
	config(state, payload) {
		state.config = payload;
	}
};

export const actions = {
	async nuxtServerInit({ commit }, { req }) {
		commit('config', {
			version: process.env.npm_package_version,
			URL: process.env.DOMAIN,
			baseURL: `${process.env.DOMAIN}${process.env.ROUTE_PREFIX}`,
			serviceName: process.env.SERVICE_NAME,
			maxFileSize: parseInt(process.env.MAX_SIZE, 10),
			chunkSize: parseInt(process.env.CHUNK_SIZE, 10),
			maxLinksPerAlbum: parseInt(process.env.MAX_LINKS_PER_ALBUM, 10),
			publicMode: process.env.PUBLIC_MODE == 'true' ? true : false,
			enableAccounts: process.env.USER_ACCOUNTS == 'true' ? true : false
		});

		let token = null;
		if (req.headers.cookie) {
			try {
				token = cookieparser.parse(req.headers.cookie).token;
				commit('loggedIn', true);
{'fraction_non_alphanumeric': 0.14978412487545667, 'fraction_numerical': 0.003985386914646297, 'mean_word_length': 4.096446700507614, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2724424', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1048, 'n_words': 209}