Compare commits
16 Commits
fix/prod
...
b8c4c6cf17
Author | SHA1 | Date | |
---|---|---|---|
b8c4c6cf17 | |||
a7dea54dc7 | |||
3d9e2b1977 | |||
aae4f97ff4 | |||
7f9a9965d2 | |||
f4a2e8cbf9 | |||
0fec2417a9 | |||
7f1986e765 | |||
07ee4b9e57 | |||
20ebad74fb | |||
aec568d0c7 | |||
0849ffe42c | |||
e13cb9bbb9 | |||
c348e2b2ac | |||
c93141e68f | |||
2ecc5c86ca |
24
Express/barAndCafe/package-lock.json
generated
24
Express/barAndCafe/package-lock.json
generated
@ -8,6 +8,7 @@
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.12.7",
|
||||
"axios": "^1.6.8",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"rimraf": "^5.0.5",
|
||||
@ -15,6 +16,7 @@
|
||||
"swagger-ui-express": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/rewire": "^2.5.30",
|
||||
"@types/supertest": "^6.0.2",
|
||||
@ -1968,6 +1970,15 @@
|
||||
"integrity": "sha512-he+DHOWReW0nghN24E1WUqM0efK4kI9oTqDm6XmK8ZPe2djZ90BSNdGnIyCLzCPw7/pogPlGbzI2wHGGmi4O/Q==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/cors": {
|
||||
"version": "2.8.17",
|
||||
"resolved": "https://registry.npmjs.org/@types/cors/-/cors-2.8.17.tgz",
|
||||
"integrity": "sha512-8CGDvrBj1zgo2qE+oS3pOCyYNqCPryMWY2bGfwA0dcfopWGgxs+78df0Rs3rc9THP4JkOhLsAa+15VdpAqkcUA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/express": {
|
||||
"version": "4.17.21",
|
||||
"resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.21.tgz",
|
||||
@ -4745,6 +4756,18 @@
|
||||
"dev": true,
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.5",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
|
||||
"integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/create-jest": {
|
||||
"version": "29.7.0",
|
||||
"resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz",
|
||||
@ -9248,7 +9271,6 @@
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^20.12.7",
|
||||
"axios": "^1.6.8",
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.19.2",
|
||||
"rimraf": "^5.0.5",
|
||||
@ -21,6 +22,7 @@
|
||||
"swagger-ui-express": "^5.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/cors": "^2.8.17",
|
||||
"@types/jest": "^29.5.12",
|
||||
"@types/rewire": "^2.5.30",
|
||||
"@types/supertest": "^6.0.2",
|
||||
|
@ -1,11 +1,13 @@
|
||||
import { getCity, getRadius, getPoiId, getBox } from "./openTripMaps"
|
||||
import express from "express"
|
||||
import cors from "cors"
|
||||
/**
|
||||
* Initialize Express application instance.
|
||||
* @returns An initialized Express application object.
|
||||
*/
|
||||
const app = express()
|
||||
|
||||
app.use(cors())
|
||||
|
||||
|
||||
/**
|
||||
|
@ -135,8 +135,9 @@ export async function getCity(req: express.Request, res: express.Response) {
|
||||
radius = "1000"
|
||||
}
|
||||
const cityPose = await callCity(cityName as string)
|
||||
res.send( await callRadius(cityPose.lon,cityPose.lat, radius as string))
|
||||
}
|
||||
const poi = await callRadius(cityPose.lon,cityPose.lat, radius as string)
|
||||
res.send( {...poi, ...cityPose})
|
||||
}//XXX: refaire test avec city
|
||||
|
||||
/**
|
||||
* Handle GET request for radius search route ('/otm/radius').
|
||||
|
@ -1,5 +1,6 @@
|
||||
vars {
|
||||
TRIPMAP_URL: https://api.opentripmap.com/0.1
|
||||
EXPRESS_API: http://localhost:3001
|
||||
}
|
||||
vars:secret [
|
||||
app_key,
|
||||
|
3
bruno/OpenData datatourisme/environments/prod.bru
Normal file
3
bruno/OpenData datatourisme/environments/prod.bru
Normal file
@ -0,0 +1,3 @@
|
||||
vars {
|
||||
EXPRESS_API: https://drink-tweb.cb85.fr
|
||||
}
|
@ -5,7 +5,7 @@ meta {
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:3001/otm/city?name=La roche sur yon&radius=300
|
||||
url: {{EXPRESS_API}}/otm/city?name=La roche sur yon&radius=300
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
16
bruno/OpenData datatourisme/otm/otm_city.bru
Normal file
16
bruno/OpenData datatourisme/otm/otm_city.bru
Normal file
@ -0,0 +1,16 @@
|
||||
meta {
|
||||
name: otm_city
|
||||
type: http
|
||||
seq: 5
|
||||
}
|
||||
|
||||
get {
|
||||
url: {{TRIPMAP_URL}}/en/places/geoname?name=paris&apikey={{OTM_KEY}}
|
||||
body: none
|
||||
auth: none
|
||||
}
|
||||
|
||||
query {
|
||||
name: paris
|
||||
apikey: {{OTM_KEY}}
|
||||
}
|
@ -18,7 +18,9 @@ services:
|
||||
- public
|
||||
|
||||
front:
|
||||
image: git.lab-ouest.org/epitech/ratrapage_t-web_front:pr-1-head
|
||||
image: git.lab-ouest.org/epitech/ratrapage_t-web_front:pr-16-head
|
||||
environment:
|
||||
- POCKETBASE_URL=https://${POCKET_BASE_URL}
|
||||
depends_on:
|
||||
- pocketbase
|
||||
labels:
|
||||
@ -30,9 +32,10 @@ services:
|
||||
- public
|
||||
|
||||
back_drink:
|
||||
image: git.lab-ouest.org/epitech/ratrapage_t-web_back:pr-6-head
|
||||
image: git.lab-ouest.org/epitech/ratrapage_t-web_back:master
|
||||
environment:
|
||||
- port=${BACK_BASE_PORT}
|
||||
- OPEN_TRIP_MAPS_KEY=${OPEN_TRIP_MAPS_KEY}
|
||||
labels:
|
||||
- traefik.enable=true
|
||||
- traefik.http.routers.expressDrinkTweb.rule=Host(`${DRINK_URL}`)
|
||||
|
@ -27,6 +27,7 @@ const whenExternalScripts = (items = []) =>
|
||||
|
||||
export default defineConfig({
|
||||
|
||||
output: 'server',
|
||||
compressHTML: true,
|
||||
build: {
|
||||
assets: 'assets',
|
||||
@ -37,7 +38,6 @@ export default defineConfig({
|
||||
port: 3000
|
||||
},
|
||||
trailingSlash: 'never',
|
||||
output: 'server',
|
||||
adapter: node({
|
||||
mode: 'standalone'
|
||||
}),
|
||||
|
@ -34,7 +34,8 @@
|
||||
"astro-icon": "^1.1.0",
|
||||
"limax": "4.1.0",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"unpic": "^3.18.0"
|
||||
"unpic": "^3.18.0",
|
||||
"tailwind-merge": "^2.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/check": "^0",
|
||||
@ -68,7 +69,6 @@
|
||||
"reading-time": "^1.5.0",
|
||||
"rehype-plugin-image-native-lazy-loading": "^1.2.0",
|
||||
"sharp": "0.33.3",
|
||||
"tailwind-merge": "^2.3.0",
|
||||
"tailwindcss": "^3.4.3",
|
||||
"typescript-eslint": "^7.9.0"
|
||||
}
|
||||
|
28
front/src/components/Input.astro
Normal file
28
front/src/components/Input.astro
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
import type { Input as Props } from 'types';
|
||||
|
||||
const { type, name, label, autocomplete, placeholder, divClass, inputClass} = Astro.props;
|
||||
|
||||
---
|
||||
|
||||
<>
|
||||
{
|
||||
name && (
|
||||
<div class={divClass}>
|
||||
{label && (
|
||||
<label for={name} class="block text-sm font-medium">
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
<input
|
||||
type={type}
|
||||
name={name}
|
||||
id={name}
|
||||
autocomplete={autocomplete}
|
||||
placeholder={placeholder}
|
||||
class={"py-3 px-4 block w-full text-md rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900" + inputClass}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
</>
|
@ -1,6 +1,6 @@
|
||||
site:
|
||||
name: AstroWind
|
||||
site: 'https://astrowind.vercel.app'
|
||||
name: EpicRoadTrip
|
||||
site: 'https://front-tweb.cb85.fr'
|
||||
base: '/'
|
||||
trailingSlash: false
|
||||
|
||||
|
6
front/src/env.d.ts
vendored
6
front/src/env.d.ts
vendored
@ -6,10 +6,10 @@
|
||||
|
||||
import PocketBase from 'pocketbase'
|
||||
export interface ImportMetaEnv {
|
||||
NODE_ENV: string
|
||||
APP_URL: string
|
||||
NODE_ENV: string
|
||||
APP_URL: string
|
||||
|
||||
POCKETBASE_URL: string
|
||||
POCKETBASE_URL: string
|
||||
|
||||
GOOGLE_API_KEY: string
|
||||
}
|
||||
|
@ -80,18 +80,4 @@ const metadata = {
|
||||
]}
|
||||
/>
|
||||
<Oauth/>
|
||||
<form id="account-creation" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="type" value="userPassword">
|
||||
<input required name="name" placeholder="Prénom Nom"/>
|
||||
<input required name="username" placeholder="Pseudo"/>
|
||||
<input required name="email" type="email" placeholder="Renseignez votre email" />
|
||||
<input required name="password" type="password" placeholder="Créez un mot de passe" />
|
||||
<input required name="passwordConfirm" type="password" placeholder="Confirmer votre mot de passe" />
|
||||
<button>Créer un compte</button>
|
||||
</form>
|
||||
|
||||
<button id="OauthDiscord">connexion avec discord</button>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="type" value="discord2FA">
|
||||
</form>
|
||||
</Layout>
|
||||
|
@ -1,31 +1,90 @@
|
||||
---
|
||||
import Layout from 'layouts/PageLayout.astro';
|
||||
import Layout from 'layouts/PageLayout.astro'
|
||||
import 'leaflet/dist/leaflet.css'
|
||||
import FormContainer from 'components/ui/Form.astro'
|
||||
import Input from 'components/Input.astro'
|
||||
import Button from 'components/ui/Button.astro'
|
||||
|
||||
const metadata = {
|
||||
title: 'Maps',
|
||||
ignoreTitleTemplate: true,
|
||||
};
|
||||
}
|
||||
---
|
||||
|
||||
<Layout metadata={metadata}>
|
||||
|
||||
<div class="flex flex-row justify-between align-center max-w-xl mx-auto rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-slate-900 shadow p-4 sm:p-6 lg:p-8 w-full">
|
||||
<Input type='text' name='search' placeholder='Paris' divClass='grow mr-4'/>
|
||||
<Button variant="primary" id='search-btn' class='grow-4'>rechercher</Button>
|
||||
</div>
|
||||
|
||||
<div class="w-full h-96" id="map" />
|
||||
|
||||
|
||||
</Layout>
|
||||
|
||||
<script>
|
||||
import L from 'leaflet'
|
||||
import L, { geoJSON, Icon, type LatLngTuple } from 'leaflet'
|
||||
import markerShadow from "leaflet/dist/images/marker-shadow.png"
|
||||
import markerIcon from "leaflet/dist/images/marker-icon.png"
|
||||
|
||||
const btn = document.querySelector('#search-btn')
|
||||
const input = document.querySelector<HTMLInputElement>('#search')
|
||||
const icon = {icon: new L.Icon({iconUrl: markerIcon.src, shadowUrl: markerShadow.src, iconAnchor: [13,41]})}
|
||||
|
||||
// const BACK_URL = "https://drink-tweb.cb85.fr/"
|
||||
const BACK_URL = "http://localhost:3001/"
|
||||
|
||||
let mapsCenter : L.LatLngTuple
|
||||
|
||||
const map = L.map('map', {
|
||||
center: [50,0],
|
||||
center: [51.5, -0.09],
|
||||
zoom: 13,
|
||||
preferCanvas: true
|
||||
})
|
||||
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
maxZoom: 19,
|
||||
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
||||
}).addTo(map);
|
||||
var marker = L.marker([51.5, -0.09]).addTo(map);
|
||||
}).addTo(map)
|
||||
|
||||
let marker = L.marker([51.5, -0.09],icon).addTo(map)
|
||||
marker.bindPopup("test")
|
||||
|
||||
|
||||
function search() {
|
||||
const params: URLSearchParams = new URLSearchParams();
|
||||
params.append("name", input!.value)
|
||||
|
||||
fetch(`${BACK_URL}otm/city?${params.toString()}`,{method: 'GET',headers: {'Content-Type': 'application/json'}}).then(function (response) {
|
||||
// The API call was successful!
|
||||
return response.json();
|
||||
}).then(function (data) {
|
||||
console.log(data);
|
||||
mapsCenter = [data.lat, data.lon]
|
||||
marker.setLatLng(mapsCenter)
|
||||
map.setView(mapsCenter)
|
||||
data.features.forEach(element => {
|
||||
console.log(element)
|
||||
const poiMarker = L.marker([element.geometry.coordinates[1],element.geometry.coordinates[0]],icon).bindPopup(element.properties)
|
||||
poiMarker.addTo(map)
|
||||
});
|
||||
}).catch(function (err) {
|
||||
console.warn('Something went wrong.', err);
|
||||
});
|
||||
}
|
||||
|
||||
btn?.addEventListener('click',search)
|
||||
input?.addEventListener('keypress',(e) =>{
|
||||
if(e.key == 'Enter'){
|
||||
search()
|
||||
}
|
||||
})
|
||||
|
||||
// marker.setLatLng(mapsCenter)
|
||||
// map.setView(mapsCenter)
|
||||
// const mark2 = map.getBounds().getNorthWest()
|
||||
// const mark3 = map.getBounds().getSouthEast()
|
||||
// let marker2 = L.marker(mark2,icon).addTo(map)
|
||||
// let marker3 = L.marker(mark3,icon).addTo(map)
|
||||
|
||||
</script>
|
||||
|
6
front/src/types.d.ts
vendored
6
front/src/types.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import type { AstroComponentFactory } from 'astro/runtime/server/index.js'
|
||||
import type { HTMLAttributes, ImageMetadata } from 'astro/types'
|
||||
import type { HTMLAttributes, ImageMetadata, HTMLInputTypeAttribute } from 'astro/types'
|
||||
|
||||
export interface Post {
|
||||
/** A unique ID number that identifies a post. */
|
||||
@ -26,7 +26,7 @@ export interface Post {
|
||||
/** */
|
||||
category?: Taxonomy
|
||||
/** */
|
||||
tags?: Taxonomy[]
|
||||
tags?: Array<Taxonomy>
|
||||
/** */
|
||||
author?: string
|
||||
|
||||
@ -167,6 +167,8 @@ export interface Input {
|
||||
label?: string
|
||||
autocomplete?: string
|
||||
placeholder?: string
|
||||
divClass?: string
|
||||
inputClass?: string
|
||||
}
|
||||
|
||||
export interface Textarea {
|
||||
|
@ -1,24 +1,25 @@
|
||||
import defaultTheme from 'tailwindcss/defaultTheme';
|
||||
import typographyPlugin from '@tailwindcss/typography';
|
||||
import defaultTheme from 'tailwindcss/defaultTheme'
|
||||
import typographyPlugin from '@tailwindcss/typography'
|
||||
|
||||
module.exports = {
|
||||
content: ['./src/**/*.{astro,html,js,jsx,json,md,mdx,svelte,ts,tsx,vue}'],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: 'var(--aw-color-primary)',
|
||||
secondary: 'var(--aw-color-secondary)',
|
||||
accent: 'var(--aw-color-accent)',
|
||||
default: 'var(--aw-color-text-default)',
|
||||
muted: 'var(--aw-color-text-muted)',
|
||||
},
|
||||
fontFamily: {
|
||||
sans: ['var(--aw-font-sans, ui-sans-serif)', ...defaultTheme.fontFamily.sans],
|
||||
serif: ['var(--aw-font-serif, ui-serif)', ...defaultTheme.fontFamily.serif],
|
||||
heading: ['var(--aw-font-heading, ui-sans-serif)', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [typographyPlugin],
|
||||
darkMode: 'class',
|
||||
};
|
||||
content: ['./src/**/*.{astro,html,js,jsx,json,md,mdx,svelte,ts,tsx,vue}'],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
primary: 'var(--aw-color-primary)',
|
||||
secondary: 'var(--aw-color-secondary)',
|
||||
accent: 'var(--aw-color-accent)',
|
||||
default: 'var(--aw-color-text-default)',
|
||||
muted: 'var(--aw-color-text-muted)',
|
||||
},
|
||||
fontFamily: {
|
||||
sans: ['var(--aw-font-sans, ui-sans-serif)', ...defaultTheme.fontFamily.sans],
|
||||
serif: ['var(--aw-font-serif, ui-serif)', ...defaultTheme.fontFamily.serif],
|
||||
heading: ['var(--aw-font-heading, ui-sans-serif)', ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [typographyPlugin],
|
||||
darkMode: 'class',
|
||||
}
|
||||
|
||||
|
@ -1,8 +0,0 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
content: ['./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}'],
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [],
|
||||
}
|
Reference in New Issue
Block a user