Put js build through phoenix

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2018-10-10 14:57:35 +02:00
parent 8d5f4d7a53
commit 3b48ac957f
18 changed files with 1637 additions and 1539 deletions

3
.gitignore vendored
View File

@ -18,5 +18,8 @@ erl_crash.dump
.elixir_ls .elixir_ls
/doc /doc
priv/static/* priv/static/*
!priv/static/.gitkeep
priv/data/*
!priv/data/.gitkeep
.vscode/ .vscode/
cover/ cover/

View File

@ -10,7 +10,7 @@ variables:
POSTGRES_USER: postgres POSTGRES_USER: postgres
POSTGRES_PASSWORD: "" POSTGRES_PASSWORD: ""
POSTGRES_HOST: postgres POSTGRES_HOST: postgres
GEOLITE_CITIES_PATH: "/builds/tcit/eventos/priv/static/GeoLite2-City.mmdb" GEOLITE_CITIES_PATH: "/builds/tcit/eventos/priv/data/GeoLite2-City.mmdb"
cache: cache:
key: "$CI_JOB_NAME" key: "$CI_JOB_NAME"
@ -27,7 +27,7 @@ before_script:
- mix deps.get - mix deps.get
- MIX_ENV=test mix ecto.create - MIX_ENV=test mix ecto.create
- MIX_ENV=test mix ecto.migrate - MIX_ENV=test mix ecto.migrate
- curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mv GeoLite2-City_*/GeoLite2-City.mmdb priv/static/GeoLite2-City.mmdb - curl http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz --output GeoLite2-City.tar.gz -s && tar zxf GeoLite2-City.tar.gz && mv GeoLite2-City_*/GeoLite2-City.mmdb priv/data/GeoLite2-City.mmdb
mix: mix:
script: script:

View File

@ -56,6 +56,6 @@ config :geolix,
%{ %{
id: :city, id: :city,
adapter: Geolix.Adapter.MMDB2, adapter: Geolix.Adapter.MMDB2,
source: System.get_env("GEOLITE_CITIES_PATH") || "priv/static/GeoLite2-City.mmdb" source: System.get_env("GEOLITE_CITIES_PATH") || "priv/data/GeoLite2-City.mmdb"
} }
] ]

3081
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build --modern",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit", "test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e" "test:e2e": "vue-cli-service test:e2e"
@ -18,21 +18,21 @@
"vue-gravatar": "^1.2.1", "vue-gravatar": "^1.2.1",
"vue-markdown": "^2.2.4", "vue-markdown": "^2.2.4",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vuetify": "^1.1.1", "vuetify": "^1.2.7",
"vuetify-google-autocomplete": "^2.0.0-beta.4", "vuetify-google-autocomplete": "^2.0.0-beta.5",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"vuex-i18n": "^1.10.5" "vuex-i18n": "^1.10.5"
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^3.0.1", "@vue/cli-plugin-babel": "^3.0.5",
"@vue/cli-plugin-e2e-nightwatch": "^3.0.1", "@vue/cli-plugin-e2e-nightwatch": "^3.0.5",
"@vue/cli-plugin-eslint": "^3.0.1", "@vue/cli-plugin-eslint": "^3.0.5",
"@vue/cli-plugin-pwa": "^3.0.1", "@vue/cli-plugin-pwa": "^3.0.5",
"@vue/cli-plugin-unit-mocha": "^3.0.1", "@vue/cli-plugin-unit-mocha": "^3.0.5",
"@vue/cli-service": "^3.0.1", "@vue/cli-service": "^3.0.5",
"@vue/eslint-config-airbnb": "^3.0.1", "@vue/eslint-config-airbnb": "^3.0.5",
"@vue/test-utils": "^1.0.0-beta.24", "@vue/test-utils": "^1.0.0-beta.25",
"chai": "^4.1.2", "chai": "^4.2.0",
"dotenv-webpack": "^1.5.7", "dotenv-webpack": "^1.5.7",
"node-sass": "^4.9.3", "node-sass": "^4.9.3",
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",

View File

@ -3,7 +3,7 @@
<v-flex xs12 sm6 offset-sm3> <v-flex xs12 sm6 offset-sm3>
<v-progress-circular v-if="loading" indeterminate color="primary"></v-progress-circular> <v-progress-circular v-if="loading" indeterminate color="primary"></v-progress-circular>
<v-card v-if="!loading"> <v-card v-if="!loading">
<v-card-media :src="actor.banner" height="400px"> <v-img :src="actor.banner || 'https://picsum.photos/400/'" height="300px">
<v-layout column class="media"> <v-layout column class="media">
<v-card-title> <v-card-title>
<v-btn icon @click="$router.go(-1)"> <v-btn icon @click="$router.go(-1)">
@ -50,7 +50,7 @@
</v-layout> </v-layout>
</v-container> </v-container>
</v-layout> </v-layout>
</v-card-media> </v-img>
<v-list three-line> <v-list three-line>
<v-list-tile> <v-list-tile>
<v-list-tile-action> <v-list-tile-action>
@ -126,10 +126,10 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>
<v-container fluid grid-list-md v-if="actor.organizingEvents && actor.organizingEvents.length > 0"> <v-container fluid grid-list-md v-if="actor.organized_events && actor.organized_events.length > 0">
<v-subheader>Organized events</v-subheader> <v-subheader>Organized events</v-subheader>
<v-layout row wrap> <v-layout row wrap>
<v-flex v-for="event in actor.organizingEvents" :key="event.id"> <v-flex v-for="event in actor.organized_events" :key="event.id">
<v-card> <v-card>
<v-card-media <v-card-media
class="black--text" class="black--text"
@ -204,13 +204,13 @@ export default {
.then((response) => { .then((response) => {
this.actor = response.data; this.actor = response.data;
this.loading = false; this.loading = false;
console.log(this.actor); console.log('actor', this.actor);
}) })
}, },
logoutUser() { logoutUser() {
auth.logout(this.$store); auth.logout(this.$store);
this.$router.push({ name: 'Home' }); this.$router.push({ name: 'Home' });
} },
} }
} }
</script> </script>

View File

@ -20,7 +20,7 @@
<v-radio label="Phone" value="phone" off-icon="phone"></v-radio> <v-radio label="Phone" value="phone" off-icon="phone"></v-radio>
<v-radio label="Other" value="other"></v-radio> <v-radio label="Other" value="other"></v-radio>
</v-radio-group> </v-radio-group>
<vuetify-google-autocomplete <!-- <vuetify-google-autocomplete
v-if="event.location_type === 'physical'" v-if="event.location_type === 'physical'"
id="map" id="map"
append-icon="search" append-icon="search"
@ -31,7 +31,7 @@
types="geocode" types="geocode"
v-on:placechanged="getAddressData" v-on:placechanged="getAddressData"
> >
</vuetify-google-autocomplete> </vuetify-google-autocomplete> -->
<v-text-field <v-text-field
v-if="event.location_type === 'online'" v-if="event.location_type === 'online'"
label="Meeting adress" label="Meeting adress"

View File

@ -4,7 +4,7 @@
<span v-if="error">Error : event not found</span> <span v-if="error">Error : event not found</span>
<v-progress-circular v-if="loading" indeterminate color="primary"></v-progress-circular> <v-progress-circular v-if="loading" indeterminate color="primary"></v-progress-circular>
<v-card v-if="!loading && !error"> <v-card v-if="!loading && !error">
<v-card-media <v-img
src="https://picsum.photos/600/400/" src="https://picsum.photos/600/400/"
height="200px" height="200px"
> >
@ -36,7 +36,7 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>
</v-card-media> </v-img>
<v-container grid-list-md> <v-container grid-list-md>
<v-layout row wrap> <v-layout row wrap>
<v-flex md10> <v-flex md10>
@ -181,6 +181,7 @@
.then((data) => { .then((data) => {
this.loading = false; this.loading = false;
this.event = data.data; this.event = data.data;
console.log('event', this.event);
}).catch((res) => { }).catch((res) => {
Promise.resolve(res).then((data) => { Promise.resolve(res).then((data) => {
console.log(data); console.log(data);

View File

@ -1,9 +1,10 @@
<template> <template>
<v-container> <v-container>
<v-jumbotron <v-img
:gradient="gradient" :gradient="gradient"
src="https://picsum.photos/1200/900" src="https://picsum.photos/1200/900"
dark dark
height="300"
v-if="$store.state.user === false" v-if="$store.state.user === false"
> >
<v-container fill-height> <v-container fill-height>
@ -15,7 +16,7 @@
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>
</v-jumbotron> </v-img>
<v-layout v-else> <v-layout v-else>
<v-flex xs12 sm8 offset-sm2> <v-flex xs12 sm8 offset-sm2>
<v-layout row wrap> <v-layout row wrap>

View File

@ -3,6 +3,7 @@ const Dotenv = require('dotenv-webpack');
module.exports = { module.exports = {
lintOnSave: false, lintOnSave: false,
runtimeCompiler: true, runtimeCompiler: true,
outputDir: '../priv/static',
configureWebpack: { configureWebpack: {
plugins: [ plugins: [
new Dotenv(), new Dotenv(),

View File

@ -73,9 +73,9 @@ defmodule Eventos.Actors.Actor do
:banner_url, :banner_url,
:user_id :user_id
]) ])
|> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{attrs["prefered_username"]}") |> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{attrs["preferred_username"]}")
|> validate_required([:preferred_username, :keys, :suspended, :url]) |> validate_required([:preferred_username, :keys, :suspended, :url])
|> unique_constraint(:prefered_username, name: :actors_preferred_username_domain_index) |> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
end end
def registration_changeset(%Actor{} = actor, attrs) do def registration_changeset(%Actor{} = actor, attrs) do
@ -94,7 +94,10 @@ defmodule Eventos.Actors.Actor do
:user_id :user_id
]) ])
|> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index) |> unique_constraint(:preferred_username, name: :actors_preferred_username_domain_index)
|> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{attrs["prefered_username"]}") |> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{attrs.preferred_username}")
|> put_change(:inbox_url, "#{EventosWeb.Endpoint.url()}/@#{attrs.preferred_username}/inbox")
|> put_change(:outbox_url, "#{EventosWeb.Endpoint.url()}/@#{attrs.preferred_username}/outbox")
|> put_change(:shared_inbox_url, "#{EventosWeb.Endpoint.url()}/inbox")
|> validate_required([:preferred_username, :keys, :suspended, :url, :type]) |> validate_required([:preferred_username, :keys, :suspended, :url, :type])
end end
@ -157,14 +160,14 @@ defmodule Eventos.Actors.Actor do
]) ])
|> put_change( |> put_change(
:outbox_url, :outbox_url,
"#{EventosWeb.Endpoint.url()}/@#{params["prefered_username"]}/outbox" "#{EventosWeb.Endpoint.url()}/@#{params["preferred_username"]}/outbox"
) )
|> put_change( |> put_change(
:inbox_url, :inbox_url,
"#{EventosWeb.Endpoint.url()}/@#{params["prefered_username"]}/inbox" "#{EventosWeb.Endpoint.url()}/@#{params["preferred_username"]}/inbox"
) )
|> put_change(:shared_inbox_url, "#{EventosWeb.Endpoint.url()}/inbox") |> put_change(:shared_inbox_url, "#{EventosWeb.Endpoint.url()}/inbox")
|> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{params["prefered_username"]}") |> put_change(:url, "#{EventosWeb.Endpoint.url()}/@#{params["preferred_username"]}")
|> put_change(:domain, nil) |> put_change(:domain, nil)
|> put_change(:type, :Group) |> put_change(:type, :Group)
|> validate_required([:url, :outbox_url, :inbox_url, :type, :name, :preferred_username]) |> validate_required([:url, :outbox_url, :inbox_url, :type, :name, :preferred_username])

View File

@ -11,9 +11,16 @@ defmodule EventosWeb.ActivityPubController do
def actor(conn, %{"name" => name}) do def actor(conn, %{"name" => name}) do
with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do with %Actor{} = actor <- Actors.get_local_actor_by_name(name) do
case get_req_header(conn, "accept") do
["application/activity+json"] ->
conn conn
|> put_resp_header("content-type", "application/activity+json") |> put_resp_header("content-type", "application/activity+json")
|> json(ActorView.render("actor.json", %{actor: actor})) |> json(ActorView.render("actor.json", %{actor: actor}))
_ ->
conn
|> put_resp_content_type("text/html")
|> send_file(200, "priv/static/index.html")
end
else else
nil -> {:error, :not_found} nil -> {:error, :not_found}
end end

View File

@ -7,6 +7,8 @@ defmodule EventosWeb.PageController do
plug(:put_layout, false) plug(:put_layout, false)
def index(conn, _params) do def index(conn, _params) do
render(conn, "index.html") conn
|> put_resp_content_type("text/html")
|> send_file(200, "priv/static/index.html")
end end
end end

View File

@ -13,7 +13,7 @@ defmodule EventosWeb.Router do
end end
pipeline :activity_pub do pipeline :activity_pub do
plug(:accepts, ["activity-json"]) plug(:accepts, ["activity-json", "text/html"])
plug(EventosWeb.HTTPSignaturePlug) plug(EventosWeb.HTTPSignaturePlug)
end end

View File

@ -1 +0,0 @@
<!DOCTYPE html><html><head><link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons" rel=stylesheet><script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBF37pw38j0giICt73TCAPNogc07Upe_Q4&libraries=places"></script><meta charset=utf-8><title>libre-event</title><link href=/css/app.a3c38b40a31fa078b9acdba649983cb5.css rel=stylesheet></head><body><noscript>Mets du JS.</noscript><div id=app></div><script type=text/javascript src=/js/manifest.881ff1dba0c9e5d0130f.js></script><script type=text/javascript src=/js/vendor.0d63a19c6680451dd336.js></script><script type=text/javascript src=/js/app.29c4f33994925affb616.js></script></body></html>

0
priv/data/.gitkeep Normal file
View File

0
priv/static/.gitkeep Normal file
View File

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB