Files
habitica/website/client/vue.config.js
Phillip Thelen 24841346dc Purge Facebook (#13696)
* Don't sign in user when trying to connect a social account that was already created

* Log social users into matching local auth accounts

If the social account has an email that already exists as a local user, instead of creating a new account log them into their account and add the social auth to the account

* If possible set local authentication email for social users

* Allow password reset emails to be sent to social login users

* lint fixes

* Fix issues and tests

* fix tests

* Fix lint error.

* purge Facebook.

Only keep it in some select places to allow for some compatablilty.

* Fix error

* fix error

* Let settings handle it when you don't have a password set but an email

* fix error

* Fix boolean logic

* fix json conversion

* .

* fix password reset for old social accounts

* Don't sign in user when trying to connect a social account that was already created

* Log social users into matching local auth accounts

If the social account has an email that already exists as a local user, instead of creating a new account log them into their account and add the social auth to the account

* If possible set local authentication email for social users

* Allow password reset emails to be sent to social login users

* lint fixes

* Fix issues and tests

* fix tests

* Fix lint error.

* purge Facebook.

Only keep it in some select places to allow for some compatablilty.

* Fix error

* fix error

* Let settings handle it when you don't have a password set but an email

* fix error

* Fix boolean logic

* fix json conversion

* fix password reset for old social accounts

* Revert "lint fixes"

This reverts commit c244b1651c.

# Conflicts:
#	website/client/src/components/auth/registerLoginReset.vue
#	website/client/src/components/static/contact.vue

* Revert "fix password reset for old social accounts"

This reverts commit 7e0069a80f.

* fix duplicate code

* chore(misc): remove irrelevant changes

* chore(privacy): update policy page with note about FB

Co-authored-by: SabreCat <sabe@habitica.com>
2022-09-15 18:22:52 -05:00

170 lines
4.3 KiB
JavaScript

/* eslint-disable import/no-commonjs */
const path = require('path');
const webpack = require('webpack');
const nconf = require('nconf');
const { DuplicatesPlugin } = require('inspectpack/plugin');
const setupNconf = require('../server/libs/setupNconf');
const pkg = require('./package.json');
const configFile = path.join(path.resolve(__dirname, '../../config.json'));
// TODO abstract from server
setupNconf(configFile, nconf);
const DEV_BASE_URL = nconf.get('BASE_URL');
const envVars = [
'AMAZON_PAYMENTS_SELLER_ID',
'AMAZON_PAYMENTS_CLIENT_ID',
'AMAZON_PAYMENTS_MODE',
'EMAILS_COMMUNITY_MANAGER_EMAIL',
'EMAILS_TECH_ASSISTANCE_EMAIL',
'EMAILS_PRESS_ENQUIRY_EMAIL',
'BASE_URL',
'GA_ID',
'STRIPE_PUB_KEY',
'GOOGLE_CLIENT_ID',
'APPLE_AUTH_CLIENT_ID',
'AMPLITUDE_KEY',
'LOGGLY_CLIENT_TOKEN',
// TODO necessary? if yes how not to mess up with vue cli? 'NODE_ENV'
];
const envObject = {};
envVars
.forEach(key => {
envObject[key] = nconf.get(key);
});
const enableDuplicatesPlugin = process.env.npm_lifecycle_event !== 'storybook:serve';
const webpackPlugins = [
new webpack.EnvironmentPlugin(envObject),
new webpack.ContextReplacementPlugin(/moment[\\/]locale$/, /^\.\/(NOT_EXISTING)$/),
];
if (enableDuplicatesPlugin) {
webpackPlugins.splice(0, 0, new DuplicatesPlugin({
verbose: true,
}));
}
module.exports = {
assetsDir: 'static',
configureWebpack: {
plugins: webpackPlugins,
},
chainWebpack: config => {
// Fix issue with duplicated deps in monorepos
// https://getpocket.com/redirect?url=https%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack%2Fissues%2F8886
// Manually resolve each dependency
Object.keys(pkg.dependencies).forEach(dep => {
config.resolve.alias
.set(dep, path.resolve(__dirname, `./node_modules/${dep}`));
});
const svgRule = config.module.rule('svg');
// clear all existing loaders.
// if you don't do this, the loader below will be appended to
// existing loaders of the rule.
svgRule.uses.clear();
// add replacement loader(s)
svgRule
.test(/\.svg$/)
.oneOf('normal')
.exclude
.add(path.resolve(__dirname, 'src/assets/svg/for-css'))
.end()
.use('svg-inline-loader')
.loader('svg-inline-loader')
.end()
.use('svgo-loader')
.loader('svgo-loader')
.options({
plugins: [
{ removeViewBox: false },
{ convertPathData: { noSpaceAfterFlags: false } },
],
})
.end()
.end()
.oneOf('in-css')
.include
.add(path.resolve(__dirname, 'src/assets/svg/for-css'))
.end()
.use('svg-in-css')
.loader('svg-url-loader')
.options({
limit: 4000,
name: 'static/svg/[contenthash].[ext]',
})
.end()
.use('svgo-loader')
.loader('svgo-loader')
.options({
plugins: [
{ removeViewBox: false },
{ convertPathData: { noSpaceAfterFlags: false } },
],
});
// Disable eslint warnings when running the server
config.module
.rule('eslint')
.use('eslint-loader')
.loader('eslint-loader')
.tap(options => {
options.quiet = true;
return options;
});
// Fix issue with Safari cache, see https://github.com/vuejs/vue-cli/issues/2509
if (process.env.NODE_ENV === 'development') {
config.plugins.delete('preload');
}
},
devServer: {
headers: { 'Cache-Control': 'no-store' },
disableHostCheck: true,
proxy: {
// proxy all requests to the server at IP:PORT as specified in the top-level config
'^/api/v3': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/api/v4': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/stripe': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/amazon': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/paypal': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/logout-server': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/export': {
target: DEV_BASE_URL,
changeOrigin: true,
},
'^/analytics': {
target: DEV_BASE_URL,
changeOrigin: true,
},
},
},
};