175 lines
4.6 KiB
JavaScript
175 lines
4.6 KiB
JavaScript
const webpack = require("webpack");
|
|
// const serverPort = 9964 || process.env.PORT
|
|
const serverPort = 8959 || process.env.PORT;
|
|
const fs = require("fs");
|
|
const wss = require("./server/socket/init");
|
|
|
|
export default {
|
|
// Global page headers: https://go.nuxtjs.dev/config-head
|
|
head: {
|
|
title: "کافه و رستوران برگ",
|
|
htmlAttrs: {
|
|
lang: "fa",
|
|
},
|
|
meta: [
|
|
{ charset: "utf-8" },
|
|
{ name: "viewport", content: "width=device-width, initial-scale=1" },
|
|
{ hid: "description", name: "description", content: "" },
|
|
{ name: "theme-color", content: "#8DC640" },
|
|
],
|
|
link: [{ rel: "icon", type: "image/x-icon", href: "/favicon.png" }],
|
|
script: [
|
|
{ src: "/js/lightBox/simple-lightbox.min.js" },
|
|
{ src: "/js/socket.io.js" },
|
|
{ src: "/js/chart.min.js" },
|
|
{ src: "https://unpkg.com/wavesurfer.js" },
|
|
],
|
|
},
|
|
loading: { color: "#fff" },
|
|
|
|
// Global CSS: https://go.nuxtjs.dev/config-css
|
|
css: [
|
|
"element-ui/lib/theme-chalk/index.css",
|
|
"slick-carousel/slick/slick.css",
|
|
"slick-carousel/slick/slick-theme.css",
|
|
"~/assets/css/bootstrap-grid.css",
|
|
"~/assets/css/reset-css.css",
|
|
"~/assets/css/fontawesome/css/all.min.css",
|
|
"~/static/js/lightBox/simple-lightbox.min.css",
|
|
"~/assets/scss/main.scss",
|
|
],
|
|
|
|
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
|
plugins: [
|
|
"@/plugins/element-ui",
|
|
"@/plugins/gsap.client",
|
|
"@/plugins/core-ui.client",
|
|
"@/plugins/datePicker.client",
|
|
"@/plugins/scrollMagic.client",
|
|
{ src: "@/plugins/mapir.js", ssr: false },
|
|
],
|
|
|
|
// Auto import components: https://go.nuxtjs.dev/config-components
|
|
components: ["~/components/", { path: "~/components/admin/", prefix: "" }],
|
|
|
|
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
|
buildModules: [],
|
|
|
|
// Modules: https://go.nuxtjs.dev/config-modules
|
|
modules: [
|
|
// https://go.nuxtjs.dev/axios
|
|
"@nuxtjs/axios",
|
|
"@nuxtjs/auth-next",
|
|
"@nuxtjs/firebase",
|
|
],
|
|
|
|
hooks: {
|
|
listen(server) {
|
|
wss(server);
|
|
},
|
|
},
|
|
|
|
firebase: {
|
|
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
|
|
config: {
|
|
apiKey: "AIzaSyB6PlyAxtiuc3Lr8PM5y2W8E_KxWrXDSkI",
|
|
authDomain: "barg-336706.firebaseapp.com",
|
|
projectId: "barg-336706",
|
|
storageBucket: "barg-336706.appspot.com",
|
|
messagingSenderId: "889370893165",
|
|
appId: "1:889370893165:web:198f891c6c49fc13a09864",
|
|
measurementId: "G-C91HQP1H4V",
|
|
},
|
|
services: {
|
|
messaging: {
|
|
createServiceWorker: true,
|
|
fcmPublicVapidKey:
|
|
"BASl8F_cCRHQWCpI_VePGRuv6G3zarylKv0wDdJOUH-IntZl90jznyHGWL6fuCNbm8yHnCFzNrIagvDWoDMaG2M",
|
|
inject: `self.addEventListener('push', function (e) {
|
|
console.log('test*******************************')
|
|
data = e.data.json();
|
|
var options = {
|
|
body: data.notification.body,
|
|
icon: '/favicon.png',
|
|
vibrate: [100, 50, 100],
|
|
data: {
|
|
dateOfArrival: Date.now(),
|
|
primaryKey: '2'
|
|
},
|
|
};
|
|
e.waitUntil(
|
|
self.registration.showNotification(data.notification.title, options)
|
|
);
|
|
});
|
|
`,
|
|
},
|
|
},
|
|
},
|
|
|
|
// Axios module configuration: https://go.nuxtjs.dev/config-axios
|
|
axios: {
|
|
proxy: true,
|
|
},
|
|
proxy: {
|
|
"/api": { target: `http://0.0.0.0:${serverPort}` },
|
|
},
|
|
// Build Configuration: https://go.nuxtjs.dev/config-build
|
|
build: {
|
|
extend(config, ctx) {
|
|
config.module.rules.push({
|
|
test: /\.(ogg|mp3|wav|mpe?g)$/i,
|
|
loader: "file-loader",
|
|
options: {
|
|
name: "[path][name].[ext]",
|
|
},
|
|
});
|
|
},
|
|
babel: {
|
|
plugins: [
|
|
["@babel/plugin-proposal-private-methods", { loose: true }],
|
|
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
|
],
|
|
},
|
|
transpile: [/^element-ui/],
|
|
plugins: [
|
|
new webpack.ProvidePlugin({
|
|
$: "jquery",
|
|
jQuery: "jquery",
|
|
"window.jQuery": "jquery",
|
|
}),
|
|
],
|
|
splitChunks: {
|
|
layouts: true,
|
|
},
|
|
},
|
|
router: {
|
|
linkActiveClass: "active-link",
|
|
middleware: ["redirects"],
|
|
},
|
|
serverMiddleware: ["~/server/index.js"],
|
|
server: {
|
|
host: "0.0.0.0",
|
|
port: 3000,
|
|
},
|
|
auth: {
|
|
strategies: {
|
|
local: {
|
|
token: {
|
|
property: "token",
|
|
required: true,
|
|
type: "",
|
|
},
|
|
user: {
|
|
property: "user",
|
|
autoFetch: true,
|
|
},
|
|
endpoints: {
|
|
login: { url: "/api/auth/login", method: "post" },
|
|
logout: { url: "/api/auth/logout", method: "delete" },
|
|
user: { url: "/api/auth/user", method: "get" },
|
|
},
|
|
},
|
|
},
|
|
},
|
|
};
|