diff --git a/config/config.exs b/config/config.exs index 146859e9a..bec1c440a 100644 --- a/config/config.exs +++ b/config/config.exs @@ -116,15 +116,6 @@ config :mobilizon, Mobilizon.Web.Email.Mailer, # can be `true` no_mx_lookups: false -config :esbuild, - version: "0.12.18", - default: [ - args: - ~w(src/main.js --bundle --target=es2016 --outdir=../priv/static/assets --external:/fonts/* --external:/images/*), - cd: Path.expand("../js", __DIR__), - env: %{"NODE_PATH" => Path.expand("../deps", __DIR__)} - ] - # Configures Elixir's Logger config :logger, :console, backends: [:console], diff --git a/config/dev.exs b/config/dev.exs index c933ee200..b079aaed9 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -15,7 +15,7 @@ config :mobilizon, Mobilizon.Web.Endpoint, check_origin: false, watchers: [ node: [ - "node_modules/.bin/vite", + "dev.js", cd: Path.expand("../js", __DIR__) ] ] @@ -40,7 +40,7 @@ config :mobilizon, Mobilizon.Web.Endpoint, config :mobilizon, Mobilizon.Web.Endpoint, live_reload: [ patterns: [ - ~r{priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$}, + ~r{priv/static/index.html$}, ~r{priv/gettext/.*(po)$}, ~r{lib/web/(live|views)/.*(ex)$}, ~r{lib/web/templates/.*(eex)$} @@ -92,3 +92,21 @@ config :mobilizon, :anonymous, reports: [ allowed: true ] + +config :mobilizon, :http_security, + enabled: true, + sts: false, + sts_max_age: 31_536_000, + csp_policy: [ + script_src: ["localhost:3000"], + style_src: [], + connect_src: [], + font_src: [], + img_src: ["*.tile.openstreetmap.org"], + manifest_src: [], + media_src: [], + object_src: [], + frame_src: [], + frame_ancestors: [] + ], + referrer_policy: "same-origin" diff --git a/js/dev.js b/js/dev.js new file mode 100644 index 000000000..3a36a66a5 --- /dev/null +++ b/js/dev.js @@ -0,0 +1,11 @@ +const { spawn } = require("child_process"); + +const child = spawn("./node_modules/.bin/vite", { stdio: "inherit" }); + +process.stdin.on("end", function () { + console.log("stdin close"); + child.kill(); + process.exit(); +}); + +process.stdin.resume(); diff --git a/js/package.json b/js/package.json index ce2bd2e10..158b2b9ff 100644 --- a/js/package.json +++ b/js/package.json @@ -11,7 +11,7 @@ "@absinthe/socket": "^0.2.1", "@absinthe/socket-apollo-link": "^0.2.1", "@apollo/client": "^3.3.16", - "@mdi/font": "^6.1.95", + "@mdi/js": "^6.3.95", "@tiptap/core": "^2.0.0-beta.41", "@tiptap/extension-blockquote": "^2.0.0-beta.6", "@tiptap/extension-bubble-menu": "^2.0.0-beta.9", @@ -42,6 +42,7 @@ "leaflet": "^1.4.0", "leaflet.locatecontrol": "^0.74.0", "lodash": "^4.17.11", + "mdi-vue": "^3.0.8", "ngeohash": "^0.6.3", "p-debounce": "^4.0.0", "phoenix": "^1.6", @@ -77,8 +78,10 @@ "flush-promises": "^1.0.2", "mock-apollo-client": "^1.1.0", "prettier": "^2.2.1", + "rollup-plugin-visualizer": "^5.5.2", "sass": "^1.43.3", "typescript": "^4.3.2", + "unplugin-icons": "^0.12.16", "vite": "^2.6.4", "vite-plugin-html": "^2.1.1", "vite-plugin-pwa": "^0.11.3", diff --git a/js/src/App.vue b/js/src/App.vue index 3e48a46f4..078506950 100644 --- a/js/src/App.vue +++ b/js/src/App.vue @@ -243,26 +243,26 @@ export default class App extends Vue { + +
+ + + + +