Browse Source

v5.0.4 - added login (pre-testing)

master
Spencer Flagg 3 years ago
parent
commit
d069776d3e
15 changed files with 943 additions and 18499 deletions
  1. +4
    -4
      components/Calendar.vue
  2. +50
    -5
      components/Map.vue
  3. +193
    -114
      components/TheSideBar.vue
  4. +254
    -10
      login/index.js
  5. +10
    -0
      middleware/auth-guard.js
  6. +17
    -0
      middleware/postRequestHandler.js
  7. +38
    -11
      nuxt.config.js
  8. +0
    -18208
      package-lock.json
  9. +5
    -2
      package.json
  10. +6
    -2
      pages/dates.vue
  11. +4
    -1
      pages/flights.vue
  12. +31
    -2
      pages/go.vue
  13. +133
    -0
      pages/veri.vue
  14. +18
    -0
      plugins/env.js
  15. +180
    -140
      yarn.lock

+ 4
- 4
components/Calendar.vue View File

@ -22,15 +22,15 @@
class="calendar__day" class="calendar__day"
> >
<span class="day__date"> {{ day.getDate() }} </span> <span class="day__date"> {{ day.getDate() }} </span>
<NuxtLink
<a
v-if=" v-if="
selectedDows.find((sched) => selectedDows.find((sched) =>
sched.DowsList.find((dow) => dow.num == day.getDay()) sched.DowsList.find((dow) => dow.num == day.getDay())
) && day > new Date() ) && day > new Date()
" "
class="btn btn--primary btn--day" class="btn btn--primary btn--day"
:to="
'/flights/' +
:href="
$BASE_URL() + '/flights/' +
$route.params.o + $route.params.o +
'/' + '/' +
$route.params.d + $route.params.d +
@ -39,7 +39,7 @@
" "
> >
<span class="day__date"> {{ day.getDate() }} </span> <span class="day__date"> {{ day.getDate() }} </span>
</NuxtLink>
</a>
<span <span
v-if=" v-if="
selectedDows.find((sched) => selectedDows.find((sched) =>

+ 50
- 5
components/Map.vue View File

@ -397,10 +397,11 @@ export default {
color: white; color: white;
} }
/* .marker-cluster {
background-clip: padding-box;
border-radius: 20px;
} */
.marker-cluster {
/* background-clip: padding-box;
border-radius: 20px; */
color: white;
}
.marker-cluster div { .marker-cluster div {
/* width: 30px; /* width: 30px;
@ -416,7 +417,7 @@ export default {
line-height: 30px; line-height: 30px;
} */ } */
#map-wrap .marker-cluster-small {
/* #map-wrap .marker-cluster-small {
background-color: rgba(47, 151, 255, 0.15); background-color: rgba(47, 151, 255, 0.15);
} }
@ -438,6 +439,50 @@ export default {
#map-wrap .marker-cluster-large div { #map-wrap .marker-cluster-large div {
background-color: rgba(0, 127, 255, 0.9); background-color: rgba(0, 127, 255, 0.9);
} */
#map-wrap .marker-cluster-small {
background-color: rgba(47, 151, 255, 0.9);
height: 30px !important;
width: 30px !important;
}
#map-wrap .marker-cluster-small div {
background-color: rgba(0, 127, 255, 0.9);
height: 20px !important;
width: 20px !important;
}
#map-wrap .marker-cluster-small div > span {
line-height: 20px;
}
#map-wrap .marker-cluster-medium {
background-color: rgba(47, 151, 255, 0.9);
}
#map-wrap .marker-cluster-medium div {
background-color: rgba(0, 127, 255, 0.9);
}
#map-wrap .marker-cluster-medium div > span {
line-height: 30px;
}
#map-wrap .marker-cluster-large {
background-color: rgba(47, 151, 255, 0.9);
height: 50px !important;
width: 50px !important;
}
#map-wrap .marker-cluster-large div {
background-color: rgba(0, 127, 255, 0.9);
height: 40px !important;
width: 40px !important;
}
#map-wrap .marker-cluster-large div > span {
line-height: 40px;
} }
</style> </style>

+ 193
- 114
components/TheSideBar.vue View File

@ -1,43 +1,91 @@
<template> <template>
<div> <div>
<button class="btn btn--primary sidebar-button" @click="showSidebar">
<svg
v-if="!isSidebarVisible"
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-menu"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="3"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
<div class="sidebar-buttons">
<!-- {{ $cookies.get('email') }}
{{ userEmail }} -->
<button
class="btn btn--primary"
v-if="isSidebarVisible && userEmail"
@click="logout"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<line x1="4" y1="8" x2="20" y2="8" />
<line x1="4" y1="16" x2="20" y2="16" />
</svg>
<svg
v-if="isSidebarVisible"
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-bar-to-right"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="3"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-logout" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2" />
<path d="M7 12h14l-3 -3m0 6l3 -3" />
</svg>
logout
</button>
<a
:href="$BASE_URL() + '/login'"
class="btn btn--primary"
v-if="isSidebarVisible && !userEmail"
> >
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<line x1="14" y1="12" x2="4" y2="12" />
<line x1="14" y1="12" x2="10" y2="16" />
<line x1="14" y1="12" x2="10" y2="8" />
<line x1="20" y1="4" x2="20" y2="20" />
</svg>
</button>
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-login" width="24" height="24" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<path d="M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2" />
<path d="M20 12h-13l3 -3m0 6l-3 -3" />
</svg>
login
</a>
<button class="btn btn--primary" @click="showSidebar">
<svg
v-if="!isSidebarVisible"
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-user-circle"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="1.5"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<circle cx="12" cy="12" r="9" />
<circle cx="12" cy="10" r="3" />
<path
d="M6.168 18.849a4 4 0 0 1 3.832 -2.849h4a4 4 0 0 1 3.834 2.855"
/>
</svg>
<svg
v-if="!isSidebarVisible"
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-menu"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="3"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<line x1="4" y1="8" x2="20" y2="8" />
<line x1="4" y1="16" x2="20" y2="16" />
</svg>
<svg
v-if="isSidebarVisible"
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrow-bar-to-right"
width="24"
height="24"
viewBox="0 0 24 24"
stroke-width="3"
stroke="#ffffff"
fill="none"
stroke-linecap="round"
stroke-linejoin="round"
>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<line x1="14" y1="12" x2="4" y2="12" />
<line x1="14" y1="12" x2="10" y2="16" />
<line x1="14" y1="12" x2="10" y2="8" />
<line x1="20" y1="4" x2="20" y2="20" />
</svg>
</button>
</div>
<aside <aside
:class="[ :class="[
'sidebar-container', 'sidebar-container',
@ -47,61 +95,68 @@
> >
<div class="sidebar"> <div class="sidebar">
<div class="sidebar-content"> <div class="sidebar-content">
<h1 class="h1--about">
What is<br>FlyLocal Alaska?
</h1>
<iframe id="lbry-iframe" src="https://odysee.com/$/embed/What-is-FlyLocal-%28fall%2C2021%2Cdesktop%29/4b6d3c94ef05cd3609a22df6b2b0d45c174957a8?r=29V3nQLvAKT88DXBMViaBRypn3iWW5WM" allowfullscreen></iframe>
<iframe v-if="false" id="lbry-iframe-mobile" src="https://odysee.com/$/embed/What-is-FlyLocal-%28fall%2C2021%2Cmobile%29/9af5d6ac694a83b95a5763dc74b87f76e6503b0e?r=Ct8Uk1dFJb5UoQzJN7ASdkypiqzkqqez" allowfullscreen></iframe>
<h1 class="h1--about">What is<br />FlyLocal Alaska?</h1>
<iframe
id="lbry-iframe"
src="https://odysee.com/$/embed/What-is-FlyLocal-%28fall%2C2021%2Cdesktop%29/4b6d3c94ef05cd3609a22df6b2b0d45c174957a8?r=29V3nQLvAKT88DXBMViaBRypn3iWW5WM"
allowfullscreen
></iframe>
<iframe
v-if="false"
id="lbry-iframe-mobile"
src="https://odysee.com/$/embed/What-is-FlyLocal-%28fall%2C2021%2Cmobile%29/9af5d6ac694a83b95a5763dc74b87f76e6503b0e?r=Ct8Uk1dFJb5UoQzJN7ASdkypiqzkqqez"
allowfullscreen
></iframe>
<div class="img-divider"> <div class="img-divider">
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F3D4.svg" src="https://openmoji.org/data/black/svg/1F3D4.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F4C5.svg" src="https://openmoji.org/data/black/svg/1F4C5.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F601.svg" src="https://openmoji.org/data/black/svg/1F601.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
</div> </div>
<p class="text--about"> <p class="text--about">
<strong>FlyLocal-Alaska</strong> is an easy way to view the <strong>FlyLocal-Alaska</strong> is an easy way to view the
schedules for your favorite Alaskan airlines - all in one place. schedules for your favorite Alaskan airlines - all in one place.
</p> </p>
<h1 class="h1--about">
Why FlyLocal<br>in Alaska?
</h1>
<h1 class="h1--about">Why FlyLocal<br />in Alaska?</h1>
<div class="img-divider"> <div class="img-divider">
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F6AB.svg" src="https://openmoji.org/data/black/svg/1F6AB.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F697.svg" src="https://openmoji.org/data/black/svg/1F697.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F6E3.svg" src="https://openmoji.org/data/black/svg/1F6E3.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
</div> </div>
<p class="text--about"> <p class="text--about">
<strong>80% of Alaskan communities are not connected to the road
system.</strong>
<strong
>80% of Alaskan communities are not connected to the road
system.</strong
>
Therefore, they rely heavily on local airlines for transportation. Therefore, they rely heavily on local airlines for transportation.
</p> </p>
<div class="img-divider"> <div class="img-divider">
@ -110,19 +165,19 @@
src="https://openmoji.org/data/black/svg/1F6A3.svg" src="https://openmoji.org/data/black/svg/1F6A3.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F3D5.svg" src="https://openmoji.org/data/black/svg/1F3D5.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F43B.svg" src="https://openmoji.org/data/black/svg/1F43B.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
</div> </div>
<p class="text--about"> <p class="text--about">
<strong>See new places.</strong> There are ~400 public airports in <strong>See new places.</strong> There are ~400 public airports in
@ -134,28 +189,26 @@
src="https://openmoji.org/data/black/svg/1F6E9.svg" src="https://openmoji.org/data/black/svg/1F6E9.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F681.svg" src="https://openmoji.org/data/black/svg/1F681.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
<img <img
class="img--about" class="img--about"
src="https://openmoji.org/data/black/svg/1F6F8.svg" src="https://openmoji.org/data/black/svg/1F6F8.svg"
alt="" alt=""
srcset="" srcset=""
>
/>
</div> </div>
<p class="text--about"> <p class="text--about">
Enjoy a completely <strong>unique flying experience</strong>. Have Enjoy a completely <strong>unique flying experience</strong>. Have
you ever landed on a lake in a seaplane? Now is your chance to check you ever landed on a lake in a seaplane? Now is your chance to check
it off the bucket-list. it off the bucket-list.
</p> </p>
<h1 class="h1--about">
Up-to-date<br>Travel Info
</h1>
<h1 class="h1--about">Up-to-date<br />Travel Info</h1>
<ul class="about-carriers list-lrg"> <ul class="about-carriers list-lrg">
<li @click="clickedLink('alaska-travel-info')"> <li @click="clickedLink('alaska-travel-info')">
<a href="https://covid19.alaska.gov/travelers/" target="_blank"> <a href="https://covid19.alaska.gov/travelers/" target="_blank">
@ -164,28 +217,32 @@
:src="require(`@/assets/images/orgs/alaska-travel-info.png`)" :src="require(`@/assets/images/orgs/alaska-travel-info.png`)"
alt="Alaska Travel Info" alt="Alaska Travel Info"
title="Alaska Travel Info" title="Alaska Travel Info"
>
/>
</a> </a>
</li> </li>
</ul> </ul>
<h1 class="h1--about"> <h1 class="h1--about">
Explore Alaska<br>on these great local airlines
Explore Alaska<br />on these great local airlines
</h1> </h1>
<ul class="about-carriers"> <ul class="about-carriers">
<li v-for="carrier in carriers" :key="carrier.id" @click="clickedCarrier(carrier.fields.Slug)">
<li
v-for="carrier in carriers"
:key="carrier.id"
@click="clickedCarrier(carrier.fields.Slug)"
>
<a :href="carrier.fields.BookingLink" target="_blank"> <a :href="carrier.fields.BookingLink" target="_blank">
<img <img
class="img--carrier-logo" class="img--carrier-logo"
:src="require(`@/assets/images/carriers/${carrier.fields.Slug}.png`)"
:src="
require(`@/assets/images/carriers/${carrier.fields.Slug}.png`)
"
:alt="carrier.fields.Name" :alt="carrier.fields.Name"
:title="carrier.fields.Name" :title="carrier.fields.Name"
>
/>
</a> </a>
</li> </li>
</ul> </ul>
<h1 class="h1--about">
Proud Member of
</h1>
<h1 class="h1--about">Proud Member of</h1>
<ul class="about-carriers list-med"> <ul class="about-carriers list-med">
<li @click="clickedLink('aaca')"> <li @click="clickedLink('aaca')">
<a href="https://alaskaaircarriers.org" target="_blank"> <a href="https://alaskaaircarriers.org" target="_blank">
@ -194,7 +251,7 @@
:src="require(`@/assets/images/orgs/aaca.png`)" :src="require(`@/assets/images/orgs/aaca.png`)"
alt="Alaska Air Carriers Association" alt="Alaska Air Carriers Association"
title="Alaska Air Carriers Association" title="Alaska Air Carriers Association"
>
/>
</a> </a>
</li> </li>
<li @click="clickedLink('alaska-tia')"> <li @click="clickedLink('alaska-tia')">
@ -204,38 +261,46 @@
:src="require(`@/assets/images/orgs/alaska-tia.png`)" :src="require(`@/assets/images/orgs/alaska-tia.png`)"
alt="Alaska Travel Industry Association" alt="Alaska Travel Industry Association"
title="Alaska Travel Industry Association" title="Alaska Travel Industry Association"
>
/>
</a> </a>
</li> </li>
</ul> </ul>
<h1 class="h1--about">
Featured on
</h1>
<h1 class="h1--about">Featured on</h1>
<ul class="about-carriers list-med"> <ul class="about-carriers list-med">
<li @click="clickedLink('1-million-cups')"> <li @click="clickedLink('1-million-cups')">
<a href="https://www.1millioncups.com/anchorage/presentations/flylocal-alaska-35304" target="_blank">
<a
href="https://www.1millioncups.com/anchorage/presentations/flylocal-alaska-35304"
target="_blank"
>
<img <img
class="img--carrier-logo" class="img--carrier-logo"
:src="require(`@/assets/images/orgs/1-million-cups.png`)" :src="require(`@/assets/images/orgs/1-million-cups.png`)"
alt="1 Million Cups" alt="1 Million Cups"
title="1 Million Cups" title="1 Million Cups"
>
/>
</a> </a>
</li> </li>
<li @click="clickedLink('travel-alaska')"> <li @click="clickedLink('travel-alaska')">
<a href="https://www.travelalaska.com/offers/FlyLocal/Plane-Statewide.aspx" target="_blank">
<a
href="https://www.travelalaska.com/offers/FlyLocal/Plane-Statewide.aspx"
target="_blank"
>
<img <img
class="img--carrier-logo" class="img--carrier-logo"
style="background: black; border-radius: 0.5rem; padding-left: 0.4rem;"
style="
background: black;
border-radius: 0.5rem;
padding-left: 0.4rem;"
:src="require(`@/assets/images/orgs/travel-alaska.png`)" :src="require(`@/assets/images/orgs/travel-alaska.png`)"
alt="Travel Alaska" alt="Travel Alaska"
title="Travel Alaska" title="Travel Alaska"
>
/>
</a> </a>
</li> </li>
</ul> </ul>
<div class="company-footer"> <div class="company-footer">
&nbsp; FlyLocal v5.0.3.0 &nbsp;&nbsp;𐄙&nbsp;&nbsp; ©2021 FlyLocal, Inc &nbsp;
&nbsp; FlyLocal v5.0.4.0 &nbsp;&nbsp;𐄙&nbsp;&nbsp; ©2021 FlyLocal,
Inc &nbsp;
</div> </div>
</div> </div>
<ul class="contact"> <ul class="contact">
@ -365,57 +430,69 @@
export default { export default {
data: () => ({ data: () => ({
isSidebarVisible: false, isSidebarVisible: false,
carriers: []
carriers: [],
userEmail: ''
}), }),
async fetch () {
const filterFormula = 'AND(IsActive=1,FIND("Alaska",Region)>0)'
const sortFormula = '&sort[0][field]=Name&sort[0][direction]=asc'
async fetch() {
this.userEmail = this.$cookies.get('email');
const filterFormula = 'AND(IsActive=1,FIND("Alaska",Region)>0)';
const sortFormula = "&sort[0][field]=Name&sort[0][direction]=asc";
let offset
let data = []
let offset;
let data = [];
while (true) { while (true) {
const offsetParam = offset ? `&offset=${offset}` : ''
const res = await fetch(`https://api.airtable.com/v0/appiQwfVZixRgRICe/Carriers_Alaska?filterByFormula=${filterFormula}${sortFormula}${offsetParam}`, {
method: 'GET',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: 'Bearer keyJ2ht64ZSN57AG1'
const offsetParam = offset ? `&offset=${offset}` : "";
const res = await fetch(
`https://api.airtable.com/v0/appiQwfVZixRgRICe/Carriers_Alaska?filterByFormula=${filterFormula}${sortFormula}${offsetParam}`,
{
method: "GET",
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: "Bearer keyJ2ht64ZSN57AG1",
},
} }
})
);
const json = await res.json()
offset = await json.offset
data = [...data, ...await json.records]
const json = await res.json();
offset = await json.offset;
data = [...data, ...(await json.records)];
// await console.log(data.length) // await console.log(data.length)
if (await !offset) { break } // Were done let's stop this thing
if (await !offset) {
break;
} // Were done let's stop this thing
} }
this.carriers = [...data]
this.carriers = [...data];
}, },
methods: { methods: {
showSidebar () {
this.isSidebarVisible = !this.isSidebarVisible
showSidebar() {
this.isSidebarVisible = !this.isSidebarVisible;
if(this.isSidebarVisible) {
this.$segment.track('sidebar__show_sidebar')
if (this.isSidebarVisible) {
this.$segment.track("sidebar__show_sidebar");
} else { } else {
this.$segment.track('sidebar__hide_sidebar')
this.$segment.track("sidebar__hide_sidebar");
} }
}, },
clickedCarrier (slug) {
this.$segment.track('sidebar__open_carrier', {
carrier: slug
clickedCarrier(slug) {
this.$segment.track("sidebar__open_carrier", {
carrier: slug,
});
},
clickedLink(slug) {
this.$segment.track("sidebar__open_link", {
carrier: slug,
}); });
}, },
clickedLink (slug) {
this.$segment.track('sidebar__open_link', {
carrier: slug
});
logout() {
this.$cookies.remove('email');
this.userEmail = '';
} }
}
}
},
};
</script> </script>
<style> <style>
@ -556,11 +633,14 @@ h1.h1--about {
transform: scale(1.05); transform: scale(1.05);
} }
.sidebar-button {
.sidebar-buttons {
position: fixed; position: fixed;
top: 1rem; top: 1rem;
right: 1rem; right: 1rem;
z-index: 1003; z-index: 1003;
display: flex;
align-content: flex-end;
gap: 1rem;
} }
.sidebar-blockui { .sidebar-blockui {
@ -626,5 +706,4 @@ ul.contact li.contact-item a:hover svg {
text-transform: uppercase; text-transform: uppercase;
color: gray; color: gray;
} }
</style> </style>

+ 254
- 10
login/index.js View File

@ -1,40 +1,284 @@
// https://github.com/portier/portier-node
// https://paul-senon.medium.com/node-express-js-cookies-set-get-secure-884311606148
import express from "express"; import express from "express";
const formParser = require("body-parser").urlencoded({ extended: false }); const formParser = require("body-parser").urlencoded({ extended: false });
import { PortierClient } from "portier"; import { PortierClient } from "portier";
const cookieParser = require('cookie-parser');
const baseURL = function () {
switch (process.env.FLYLOCAL_ENV) {
case "prod":
return process.env.PROD_ENV;
case "dev":
return process.env.DEV_ENV;
case "local":
return "http://" + process.env.LOCAL_IP + ":" + process.env.LOCAL_PORT;
default:
break;
}
};
// GET / Render homepage
// POST /login Redirect to the broker and begin authentication
// POST /verify Receive an id_token via the broker and complete login
// POST /logout Clear session cookies
// GET /logout Display a button to POST /logout
const portier = new PortierClient({ const portier = new PortierClient({
//broker: "https://broker.flylocal.io",
redirectUri: ((process.env.NODE_ENV !== 'production') ? "http://localhost:3010" : "https://iflylocal.com") + "/login/verify",
//broker: process.env.PORTIER_URL,
redirectUri: baseURL() + "/login/verify",
}); });
const stylesheet = `
<style>
html {
font-size: max(4vmin, 18px);
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
line-height: 1.5;
}
body {
display: flex;
flex-direction: column;
align-items: center;
height: 100%;
padding: 0 1rem;
justify-content: center;
margin: 0;
}
header {
font-size: min(3vmin, 18px);
position: fixed;
top: 0;
width: 100vw;
z-index: 403;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
padding: 1em 1em 0.75em 1em;
pointer-events: none;
}
.header__col{
text-align: center;
}
#flylocal-logo {
height: clamp(20px, 4rem, 50px);
transition: all 0.3s;
}
.cls-1 {
fill: #9cb7f3;
}
.cls-2 {
fill: #2f80ed;
}
.cls-3 {
fill: #000;
transition: all 0.3s;
}
.nav-is-showing #flylocal-logo {
height: 3rem;
}
.nav-is-showing .cls-3 {
fill: #000;
}
.white-bkg .cls-3 {
fill: #000;
}
main {
max-width: 15rem;
}
form {
display: flex;
gap: .5rem;
flex-wrap: wrap;
justify-content: end;
}
h1 {
font-size: 1rem;
text-transform: uppercase;
font-weight: 900;
}
.btn {
border-radius: 999px;
padding: 0.5em 0.8em;
font-size: .75rem;
white-space: nowrap;
transition: 0.2s all;
display: flex;
align-items: center;
/* justify-content: space-around; what was this for? */
justify-content: center;
gap: 0.25rem;
line-height: 1;
min-height: 1em;
border: 0;
text-decoration: none;
cursor: pointer;
}
.btn svg {
height: 1rem;
width: 1rem;
display: inline-block;
aspect-ratio: 1;
transition: 0.2s all;
}
.btn.btn--primary {
background: #007fff;
color: #fff;
}
.btn.btn--primary:hover {
background: #00ca00;
color: #fff;
}
.btn.btn--primary:hover svg {
stroke: #ffffff;
}
input {
background: #eee;
border-radius: 0.5rem 3rem 3rem 3rem;
transition: 0.3s all;
padding: 0.5em 0.8em;
font-size: .75rem;
line-height: 1;
border: 0;
width: 100%;
}
</style>`;
const header = `
<header>
<div class="header__col"></div>
<div class="header__col">
<svg id="flylocal-logo" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1107.17 373.96">
<path class="cls-1" d="M.1,242.9a55.68,55.68,0,0,0,111.24-2.42,54.61,54.61,0,0,0-.44-8.21l-.05,0c-3.86-37.55-29.44-82.66-32.6-90.5-6.84,5.84-48.77,34.79-68.78,66.73l-.05,0A55.95,55.95,0,0,0,.1,242.9Z" /><path class="cls-2" d="M141.36,52.27A55.68,55.68,0,0,0,33.8,35.74a57.55,57.55,0,0,0-2.27,7.42,55.82,55.82,0,0,0-1.41,11.53,54.75,54.75,0,0,0,.45,8.22h.05c3.86,37.55,29.79,83.67,32.59,90.5,6.2-4.83,48.77-34.79,68.79-66.73h.05a55.89,55.89,0,0,0,9.31-34.41ZM85.88,56a13,13,0,1,1,15.59-9.74A13,13,0,0,1,85.88,56Z" /><path class="cls-3" d="M156.34,293.15l34.58-173.28H166.33l5.36-26.81h24.6l5.18-25.71q6.83-34,24.5-50.3C242.74,1.6,268.46-2.8,290,3.55c1.12.33,2.24.69,3.34,1.08-.58,2.8-7.2,29.89-7,30-7.63-2.37-16.2-3.35-24-1.43C246.75,37,241.44,53.31,238.64,67.35l-5.18,25.71h32.73l-5.36,26.81H228.09L193.51,293.15Z" /><path class="cls-3" d="M290.8,293.15h-37L311.51,4.66h37Z" /><path class="cls-3" d="M393,224.17l.19,11.1,1.11.18,64-142.39H498.6L385.79,324.22a140.35,140.35,0,0,1-25.06,35.13Q346.21,374,324.58,374a47.75,47.75,0,0,1-9.34-1q-5.08-1-9.89-2.31L315,342.89q2,.38,5.27.74a46.84,46.84,0,0,0,5.09.37q9.44,0,17.85-9.71a91.86,91.86,0,0,0,14-21.72l10.17-20L348.44,93.06h40.31Z" /><path class="cls-3" d="M511.33,293.15h-37L532,4.66h37Z" /><path class="cls-3" d="M553.53,180.53q6.47-41.43,30.14-66.3t58.81-24.87q33.09,0,49.56,25.89t10.17,65.28l-4.07,25.52q-6.66,41.61-30.24,66.29T609.56,297q-33.46,0-50-25.7t-10.08-65.28Zm32.91,25.52q-4.62,28.48,1.85,45.49t25.71,17q17.75,0,30.14-17.75T661,206.05L665,180.53q4.44-27.92-1.94-45.12t-25.25-17.2q-18.3,0-30.69,17.75t-16.65,44.57Z" /><path class="cls-3" d="M779.81,268.55q12.57,0,23.49-10.81t13.87-29h33.1l.37,1.11q-4.26,29.41-26,48.27T775.37,297q-34.39,0-50-25.61t-9.52-64.26l4.44-27.56q6.47-40.48,29.31-65.37t58.9-24.87q28.1,0,43.45,20.53t10.17,53.26H827.52q3.33-20.72-3.14-32.83t-20.53-12.11q-19.23,0-30.79,17.57T757.44,179.6L753,207.16q-4.44,28.11,1,44.75T779.81,268.55Z" /><path class="cls-3" d="M956.91,293.15q-.37-7.39-.37-13.69a101.53,101.53,0,0,1,.74-12.39,93.25,93.25,0,0,1-23.95,21.64Q919.92,297,905.68,297q-22.56,0-33.93-16.27t-6-42.53q6.1-30.53,27.46-46T949,176.83h25.89l4.06-20.53q3.71-19.41-1.57-29.12t-19.51-9.71q-11.64,0-21.45,9.34a41.72,41.72,0,0,0-12.39,23l-35.32-.18-.37-1.11q4.07-24.6,25.8-41.89t51.68-17.29q26.64,0,41.61,17.75t8.69,49.56l-18.67,92.84a183.7,183.7,0,0,0-3.15,22.56,133.93,133.93,0,0,0,.19,21.08Zm-37-25q11.28,0,23-7.76a63.41,63.41,0,0,0,18.95-19.24L970,200.13H943.78q-14.81,0-26.26,11.28A49.81,49.81,0,0,0,903.1,238q-3,14.43,1.29,22.28T919.92,268.18Z" /><path class="cls-3" d="M1049.48,293.15h-37l57.7-288.49h37Z" />
</svg>
</div>
<div class="header__col"></div>
</header>
`;
const app = express(); const app = express();
app.use(express.json()) app.use(express.json())
app.use(express.urlencoded({ extended: false })) app.use(express.urlencoded({ extended: false }))
// pass argument into cookie parser to make it secret
//app.use(cookieParser(process.env.PORTIER_SECRET));
app.use(cookieParser());
app.get("/", (req, res) => { app.get("/", (req, res) => {
const redirect =
(req.query.redirect && typeof req.query.redirect !== 'undefined') ? '<input name="redirect" type="hidden" value="' + req.query.redirect + '">' : '';
const note =
(req.query.redirect && typeof req.query.redirect !== 'undefined') ? `<h1>Want to book a flight?<br/>Take 10 seconds and log in.</h1>` : '';
res.type("html").end(` res.type("html").end(`
<p>Enter your email address:</p>
<form method="post" action="/login/auth">
<input name="email" type="email">
<button type="submit">Login</button>
</form>
${header}
<main>
${note}
<p>To log in, just enter your email address and we'll send you a magic link. </p>
<p><strong>No new password to remember!</strong></p>
<form method="post" action="/login/auth">
${redirect}
<input name="email" type="email" value="spencer@seasteading.org" placeholder="coolname@website.com" pattern="/(?:[a-z0-9!#$%&'*+/=?^_{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/" required>
<button type="submit" class="btn btn--primary">
get my link
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-wand" width="40" height="40" viewBox="0 0 24 24" stroke-width="1.5" stroke="#ffffff" fill="none" stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<polyline points="6 21 21 6 18 3 3 18 6 21" />
<line x1="15" y1="6" x2="18" y2="9" />
<path d="M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2" />
<path d="M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2" />
</svg>
</button>
</form>
</main>
${stylesheet}
`); `);
// email = cookies('email')
// if email:
// return template('verified', email=email)
// else:
// return template('index')
}); });
app.post("/auth", formParser, (req, res) => { app.post("/auth", formParser, (req, res) => {
//console.log(req.body);
portier.authenticate(req.body.email).then((authUrl) => { portier.authenticate(req.body.email).then((authUrl) => {
res.redirect(303, authUrl);
if (req.body.redirect && typeof req.body.redirect !== 'undefined') {
res.redirect(303, authUrl + '?redirect=' + req.body.redirect);
} else {
res.redirect(303, authUrl);
}
}); });
}); });
app.post("/verify", formParser, (req, res) => { app.post("/verify", formParser, (req, res) => {
//console.log(req.body);
portier.verify(req.body.id_token).then((email) => { portier.verify(req.body.id_token).then((email) => {
res.type("html").end(`
<p>Verified email address ${email}!</p>
const redirectButton = (req.query.redirect && typeof req.query.redirect !== 'undefined') ? `<a class="btn btn--primary" href="${req.query.redirect}">back to your flight</a>` : `<a class="btn btn--primary" href="${baseURL()}">back to the map</a>`;
// needed to string .cookie and .type together
res.cookie('email', email,
{
//httpOnly: true,
// 👆 blocks access by JavaScript; prevents cookie manipulation
// 👆 can't be gotten by $cookies.get. this probably needs to be hardened
maxAge: 1000 * 60 * 60 * 24 * 30,
//signed: false,
//domain: baseURL(),
path: "/"
}).type("html").end(`
${header}
<main>
<p>Great! You're logged in.</p>
${redirectButton}
</main>
${stylesheet}
`); `);
}); });
}); });
// app.get("/check", (req, res) => {
// //req.signedCookies.name='Gourav';
// //req.signedCookies.age=12;
// const cookie = req.signedCookies.email;
// console.log(cookie);
// //console.log(req.signedCookies.name);
// res.send();
// });
// app.get("/logout", (req, res) => {
// res.clearCookie("email");
// res.send('forgotten');
// });
//app.post("/logout")
//res.clearCookie("email");
// app.get('/test', function (req, res) { // app.get('/test', function (req, res) {
// res.send('Test successful') // res.send('Test successful')
// }) // })

+ 10
- 0
middleware/auth-guard.js View File

@ -0,0 +1,10 @@
export default function ({ route, redirect, app }) {
//console.log("auth: " + $auth)
console.log("app: " + app)
if (route.path.includes('/flights')) {
const REDIRECT_URL = '/login/?redirect=' + route.path
if (!app.$cookies.get('email')) {
redirect(REDIRECT_URL)
}
}
}

+ 17
- 0
middleware/postRequestHandler.js View File

@ -0,0 +1,17 @@
export default function (req, res, next) {
// req is the Node.js http request object
console.log('middle')
// res is the Node.js http response object
// next is a function to call to invoke the next middleware
// Don't forget to call next at the end if your middleware is not an endpoint!
next()
}
//// Clickout.vue
// async asyncData(context) {
// const id = context.req.body.id;
// return { id }
// }

+ 38
- 11
nuxt.config.js View File

@ -1,4 +1,22 @@
const baseURL = function() {
switch (process.env.FLYLOCAL_ENV) {
case "prod":
return process.env.PROD_ENV;
case "dev":
return process.env.DEV_ENV;
case "local":
return "http://" + process.env.LOCAL_IP + ":" + process.env.LOCAL_PORT;
default:
break;
}
};
export default { export default {
env: {
baseURL: baseURL()
},
// Global page headers: https://go.nuxtjs.dev/config-head // Global page headers: https://go.nuxtjs.dev/config-head
head: { head: {
title: 'FlyLocal', title: 'FlyLocal',
@ -9,16 +27,16 @@ export default {
{ name: 'format-detection', content: 'telephone=no' }, { name: 'format-detection', content: 'telephone=no' },
{ itemprop: 'name', content: 'Small Planes, Big Experiences' }, { itemprop: 'name', content: 'Small Planes, Big Experiences' },
{ itemprop: 'description', content: 'FlyLocal is the best way to find local airlines that fly throughout the great state of Alaska. Explore the \'Last Frontier\' with FlyLocal.' }, { itemprop: 'description', content: 'FlyLocal is the best way to find local airlines that fly throughout the great state of Alaska. Explore the \'Last Frontier\' with FlyLocal.' },
{ itemprop: 'image', content: 'https://flylocal.us/screenshot.png' },
{ property: 'og:url', content: 'https://iflylocal.com/' },
{ itemprop: 'image', content: baseURL() + '/screenshot.png' },
{ property: 'og:url', content: baseURL() },
{ property: 'og:type', content: 'website' }, { property: 'og:type', content: 'website' },
{ property: 'og:title', content: 'Small Planes, Big Experiences' }, { property: 'og:title', content: 'Small Planes, Big Experiences' },
{ property: 'og:description', content: 'FlyLocal is the best way to find local airlines that fly throughout the great state of Alaska. Explore the \'Last Frontier\' with FlyLocal.' }, { property: 'og:description', content: 'FlyLocal is the best way to find local airlines that fly throughout the great state of Alaska. Explore the \'Last Frontier\' with FlyLocal.' },
{ property: 'og:image', content: 'https://flylocal.us/screenshot.png' },
{ property: 'og:image', content: baseURL() + '/screenshot.png' },
{ name: 'twitter:card', content: 'summary_large_image' }, { name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:title', content: 'Small Planes, Big Experiences' }, { name: 'twitter:title', content: 'Small Planes, Big Experiences' },
{ name: 'twitter:description', content: 'FlyLocal is the best way to find local airlines that fly throughout the great state of Alaska. Explore the \'Last Frontier\' with FlyLocal.' }, { name: 'twitter:description', content: 'FlyLocal is the best way to find local airlines that fly throughout the great state of Alaska. Explore the \'Last Frontier\' with FlyLocal.' },
{ name: 'twitter:image', content: 'https://flylocal.us/screenshot.png' }
{ name: 'twitter:image', content: baseURL() + '/screenshot.png' }
], ],
link: [ link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' } { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
@ -26,13 +44,15 @@ export default {
}, },
server: (process.env.NODE_ENV !== 'production') ? { server: (process.env.NODE_ENV !== 'production') ? {
host: '192.168.178.100',
port: 3010
host: process.env.LOCAL_IP,
port: process.env.LOCAL_PORT
} : {}, } : {},
serverMiddleware: [ serverMiddleware: [
{ path: '/', handler: '~/middleware/redirects.js' }, { path: '/', handler: '~/middleware/redirects.js' },
{ path: '/login', handler: '~/login'}
{ path: '/login', handler: '~/login'},
{ path: '/clickout', handler: '~/middleware/postRequestHandler.js' },
//{ path: '/flights', handler: '~/middleware/auth-guard.js'}
], ],
// Global CSS: https://go.nuxtjs.dev/config-css // Global CSS: https://go.nuxtjs.dev/config-css
@ -44,15 +64,18 @@ export default {
plugins: [ plugins: [
{ src: '~/plugins/vue2-leaflet-markercluster.js', mode: 'client' }, { src: '~/plugins/vue2-leaflet-markercluster.js', mode: 'client' },
'~plugins/v-mask.js', '~plugins/v-mask.js',
'~plugins/vue-phone-number-input.js'
'~plugins/vue-phone-number-input.js',
'~/plugins/env.js'
], ],
// Auto import components: https://go.nuxtjs.dev/config-components // Auto import components: https://go.nuxtjs.dev/config-components
components: true, components: true,
router: { router: {
middleware: ['auth-guard'],
extendRoutes (routes, resolve) { extendRoutes (routes, resolve) {
routes.push( routes.push(
// don't need to specify these when there are no params
{ {
name: 'go-orig-dest', name: 'go-orig-dest',
path: '/go/:o/:d', path: '/go/:o/:d',
@ -90,7 +113,8 @@ export default {
'@nuxtjs/stylelint-module', '@nuxtjs/stylelint-module',
// https://go.nuxtjs.dev/tailwindcss // https://go.nuxtjs.dev/tailwindcss
'@nuxtjs/tailwindcss', '@nuxtjs/tailwindcss',
'@nuxtjs/style-resources'
'@nuxtjs/style-resources',
'@nuxtjs/dotenv' // (environment variables)
], ],
styleResources: { styleResources: {
@ -111,9 +135,11 @@ export default {
[ [
'@adinvadim/nuxt-segment-analytics', '@adinvadim/nuxt-segment-analytics',
{ {
id: (process.env.NODE_ENV !== 'production') ? "9dEbke7oGZjUCbF01hbcycoHxrpLvVBV" : "QpcGXqVfScXUfRPbAGkbtyst6x5HNpRf",
id: (process.env.FLYLOCAL_ENV === 'prod') ? "QpcGXqVfScXUfRPbAGkbtyst6x5HNpRf" : "9dEbke7oGZjUCbF01hbcycoHxrpLvVBV",
useRouter: true useRouter: true
}]
}
],
['cookie-universal-nuxt']
], ],
// Axios module configuration: https://go.nuxtjs.dev/config-axios // Axios module configuration: https://go.nuxtjs.dev/config-axios
@ -144,4 +170,5 @@ export default {
}, },
dev: process.env.NODE_ENV !== 'production' dev: process.env.NODE_ENV !== 'production'
} }

+ 0
- 18208
package-lock.json
File diff suppressed because it is too large
View File


+ 5
- 2
package.json View File

@ -1,6 +1,6 @@
{ {
"name": "flylocal", "name": "flylocal",
"version": "5.0.3.0",
"version": "5.0.4.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "nuxt", "dev": "nuxt",
@ -13,15 +13,18 @@
}, },
"dependencies": { "dependencies": {
"@nuxtjs/axios": "^5.13.6", "@nuxtjs/axios": "^5.13.6",
"@nuxtjs/dotenv": "^1.4.1",
"@nuxtjs/pwa": "^3.3.5", "@nuxtjs/pwa": "^3.3.5",
"@nuxtjs/style-resources": "^1.2.1", "@nuxtjs/style-resources": "^1.2.1",
"airtable": "^0.11.1", "airtable": "^0.11.1",
"autoprefixer": "^10.3.4", "autoprefixer": "^10.3.4",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"cookie-parser": "^1.4.6",
"cookie-universal-nuxt": "^2.1.5",
"core-js": "^3.15.1", "core-js": "^3.15.1",
"express": "^4.17.1", "express": "^4.17.1",
"fibers": "^5.0.0",
"leaflet": "^1.7.1", "leaflet": "^1.7.1",
"net": "^1.0.2",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"nuxt": "^2.15.7", "nuxt": "^2.15.7",
"nuxt-leaflet": "^0.0.25", "nuxt-leaflet": "^0.0.25",

+ 6
- 2
pages/dates.vue View File

@ -156,7 +156,11 @@ export default {
destination: this.$route.params.d destination: this.$route.params.d
}) })
this.$router.go(-1)
//this.$router.go(-1)
this.$router.push({
path: '/go/' + this.$route.params.o + "/" + this.$route.params.d
})
}, },
book (schedule) { book (schedule) {
if (schedule.fields.IsExpedia[0] === 'true') { if (schedule.fields.IsExpedia[0] === 'true') {
@ -168,7 +172,7 @@ export default {
} }
}, },
clearSelectedSchedule () { clearSelectedSchedule () {
console.log('clear')
//console.log('clear')
this.startingDate = '' this.startingDate = ''
this.selectedSchedule = {} this.selectedSchedule = {}
}, },

+ 4
- 1
pages/flights.vue View File

@ -440,7 +440,10 @@ export default {
destination: this.$route.params.d, destination: this.$route.params.d,
departureDate: this.$route.params.departure, departureDate: this.$route.params.departure,
}) })
this.$router.go(-1)
//this.$router.go(-1)
this.$router.push({
path: '/dates/' + this.$route.params.o + "/" + this.$route.params.d
})
}, },
// book2 (schedule) { // book2 (schedule) {
// if (schedule.fields.IsExpedia[0] === 'true') { // if (schedule.fields.IsExpedia[0] === 'true') {

+ 31
- 2
pages/go.vue View File

@ -56,7 +56,8 @@
</div> </div>
</div> </div>
</div> </div>
<div class="header__col" />
<div class="header__col">
</div>
</header> </header>
<!-- <pre style="position: fixed; z-index: 500; right: 0; top: 2rem; font-size: 0.6rem; color: gray;"> <!-- <pre style="position: fixed; z-index: 500; right: 0; top: 2rem; font-size: 0.6rem; color: gray;">
{{ selectedOrig }} {{ selectedOrig }}
@ -104,6 +105,8 @@
<script> <script>
// import AirportPicker from '../components/AirportPicker.vue' // import AirportPicker from '../components/AirportPicker.vue'
//import cookies from cookie-universal-nuxt
export default { export default {
// components: { AirportPicker }, // components: { AirportPicker },
data () { data () {
@ -155,7 +158,8 @@ export default {
municipality: '', municipality: '',
type: '', type: '',
search: '' search: ''
}
},
userEmail: ''
} }
}, },
async fetch () { async fetch () {
@ -177,6 +181,14 @@ export default {
data = [...data, ...await json.records] data = [...data, ...await json.records]
await console.log(data.length) await console.log(data.length)
const emailCookie = await this.$cookies.get('email')
console.log("cookie in fetch: " + emailCookie) // shows up with cookie in terminal, and undefined in browser
if (await emailCookie && (typeof await emailCookie !== 'undefined')) {
console.log("cookie was set")
this.userEmail = await emailCookie
}
console.log("variable in fetch: " + this.userEmail)
if (await !offset) { break } // Were done let's stop this thing if (await !offset) { break } // Were done let's stop this thing
} }
@ -216,6 +228,23 @@ export default {
if (this.$route && this.$route.params && this.$route.params.d) { if (this.$route && this.$route.params && this.$route.params.d) {
this.fetchSingleAirport(this.$route.params.d, false) this.fetchSingleAirport(this.$route.params.d, false)
} }
// this.$cookies.set('at-go', 'set', {
// path: '/',
// maxAge: 60 * 60 * 24 * 7
// })
//this.userEmail = this.$cookies.get('at-go')
},
mounted () {
// //const cookieRes = await fetch( "http://" + process.env.LOCAL_IP + ":" + process.env.LOCAL_PORT + '/login/check', { method: 'GET' })
// //await console.log(cookieRes.json())
//console.log('asdf')
//console.log(this)
//console.log(this.$cookies)
//console.log("mounted " + this.$cookies.get('email'))
//this.userEmail = this.$cookies.get('email')
}, },
// watch: { // watch: {
// history (to, from) { // history (to, from) {

+ 133
- 0
pages/veri.vue View File

@ -0,0 +1,133 @@
<template>
<main class="empty-page white-bkg">
<NuxtLogo />
<NuxtLink to="/go" class="btn btn--primary"> go to the site </NuxtLink>
</main>
</template>
<script>
import { PortierClient } from "portier";
//import ENV from "../plugins/env.js";
export default {
loading: {
color: "#007fff",
height: "1rem",
},
// data () {
// return {
// portier: new PortierClient({
// //broker: process.env.PORTIER_URL,
// redirectUri: this.$config.env.baseURL() + "/login/verify",
// })
// }
// },
created() {
this.$cookies.set("at-veri", "set", {
path: "/",
maxAge: 60 * 60 * 24 * 7,
});
},
// mounted() {
// console.log(this.$BASE_URL());
// const portier = new PortierClient({
// //broker: process.env.PORTIER_URL,
// redirectUri: this.$BASE_URL() + "/login/verify",
// });
// portier.verify(req.body.id_token).then((email) => {
// const redirectButton = req.query.redirect
// ? `<a href="${req.query.redirect}">${req.query.redirect}</a>`
// : `<a href="${ENV.BASE_URL}">${ENV.BASE_URL}</a>`;
// // needed to string .cookie and .type together
// res
// .cookie("email", email, {
// httpOnly: true, // blocks access by JavaScript; prevents cookie manipulation
// maxAge: 60 * 60 * 24 * 30,
// signed: false,
// domain: ENV.BASE_URL,
// path: "/go",
// })
// .type("html").end(`
// <p>Verified email address ${email}!</p>
// ${redirectButton}
// `);
// });
// },
// async asyncData(context, { req, res }) {
// //console.log(req.body)
// const portier = new PortierClient({
// //broker: process.env.PORTIER_URL,
// redirectUri: context.$BASE_URL() + "/login/verify",
// });
// // portier.verify(context.req.body.id_token).then((email) => {
// // // const redirectButton = req.query.redirect
// // // ? `<a href="${req.query.redirect}">${req.query.redirect}</a>`
// // // : `<a href="${context.$BASE_URL()}">${context.$BASE_URL()}</a>`;
// // // // needed to string .cookie and .type together
// // // res
// // // .cookie("email", email, {
// // // httpOnly: true, // blocks access by JavaScript; prevents cookie manipulation
// // // maxAge: 60 * 60 * 24 * 30,
// // // signed: false,
// // // domain: context.$BASE_URL(),
// // // path: "/go",
// // // })
// // // .type("html").end(`
// // // <p>Verified email address ${email}!</p>
// // // ${redirectButton}
// // // `);
// // context.$cookies.set("at-veri", "set", {
// // path: "/",
// // maxAge: 60 * 60 * 24 * 7,
// // });
// // console.log(email);
// // });
// },
async fetch(context) {
//console.log(context)
console.log(context.req)
console.log(context.req.body)
//console.log("fetch " + res.$BASE_URL());
// console.log(this.$BASE_URL)
// console.log($BASE_URL)
// const portier = new PortierClient({
// //broker: process.env.PORTIER_URL,
// redirectUri: this.$BASE_URL + "/login/verify",
// });
// portier.verify(req.body.id_token).then((email) => {
// const redirectButton = req.query.redirect
// ? `<a href="${req.query.redirect}">${req.query.redirect}</a>`
// : `<a href="${ENV.BASE_URL}">${ENV.BASE_URL}</a>`;
// // needed to string .cookie and .type together
// res
// .cookie("email", email, {
// httpOnly: true, // blocks access by JavaScript; prevents cookie manipulation
// maxAge: 60 * 60 * 24 * 30,
// signed: false,
// domain: ENV.BASE_URL,
// path: "/go",
// })
// .type("html").end(`
// <p>Verified email address ${email}!</p>
// ${redirectButton}
// `);
// });
},
};
</script>
<style scoped>
html {
background-color: black;
}
.empty-page {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
</style>

+ 18
- 0
plugins/env.js View File

@ -0,0 +1,18 @@
const BASE_URL = function () {
switch (process.env.FLYLOCAL_ENV) {
case "prod":
return process.env.PROD_ENV;
case "dev":
return process.env.DEV_ENV;
case "local":
return "http://" + process.env.LOCAL_IP + ":" + process.env.LOCAL_PORT;
default:
break;
}
}
export default ({ app }, inject) => {
// Inject $hello(msg) in Vue, context and store.
inject('BASE_URL', () => BASE_URL())
inject('hello', msg => console.log(`Hello ${msg}!`))
}

+ 180
- 140
yarn.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save