aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar vantezzen <properly@protonmail.com>2019-09-05 10:38:50 +0200
committerLibravatar vantezzen <properly@protonmail.com>2019-09-05 10:38:50 +0200
commit843db021a1e8490a72cec55a81cd36c2842284c2 (patch)
tree97693aaa2414012a80199c2f6bc647e0427b5eea
parentAdd link to account dashboard (diff)
downloadferdium-server-843db021a1e8490a72cec55a81cd36c2842284c2.tar.gz
ferdium-server-843db021a1e8490a72cec55a81cd36c2842284c2.tar.zst
ferdium-server-843db021a1e8490a72cec55a81cd36c2842284c2.zip
Convert static pages to edge views
-rw-r--r--public/import.html95
-rw-r--r--public/index.html49
-rw-r--r--public/new.html115
-rw-r--r--resources/views/others/import.edge19
-rw-r--r--resources/views/others/index.edge38
-rw-r--r--resources/views/others/new.edge40
-rw-r--r--start/routes.js12
7 files changed, 105 insertions, 263 deletions
diff --git a/public/import.html b/public/import.html
deleted file mode 100644
index 5c75d23..0000000
--- a/public/import.html
+++ /dev/null
@@ -1,95 +0,0 @@
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <title>Import Franz account</title>
9
10 <link rel="stylesheet" href="css/vanilla.css">
11
12 <style>
13 input {
14 margin-bottom: 1rem;
15 width: 100%;
16 padding: 0.5rem;
17 }
18
19 button {
20 display: flex;
21 overflow: hidden;
22 padding: 12px 12px;
23 cursor: pointer;
24 width: 100%;
25 -webkit-user-select: none;
26 -moz-user-select: none;
27 -ms-user-select: none;
28 user-select: none;
29 transition: all 150ms linear;
30 text-align: center;
31 white-space: nowrap;
32 text-decoration: none !important;
33 text-transform: none;
34 text-transform: capitalize;
35 color: #fff;
36 border: 0 none;
37 border-radius: 4px;
38 font-size: 13px;
39 font-weight: 500;
40 line-height: 1.3;
41 -webkit-appearance: none;
42 -moz-appearance: none;
43 appearance: none;
44 justify-content: center;
45 align-items: center;
46 flex: 0 0 160px;
47 box-shadow: 2px 5px 10px #e4e4e4;
48 color: #FFFFFF;
49 background: #161616;
50 }
51
52 #dropzone {
53 width: 100%;
54 height: 30vh;
55 background-color: #ebebeb;
56
57 display: flex;
58 align-items: center;
59 justify-content: center;
60 text-align: center;
61
62 cursor: pointer;
63 }
64
65 #dropzone p {
66 font-size: 0.85rem;
67 }
68
69 #files {
70 display: none;
71 }
72
73 </style>
74</head>
75
76<body>
77 <h1>Import a Franz account</h1>
78 <p>Please login using your Franz account. We will create a new Ferdi account with the same credentials.</p>
79 <form action="import" method="post">
80 <label for="email">E-Mail address</label><br />
81 <input type="email" name="email" placeholder="joe@example.com" required><br />
82
83 <label for="password">Password</label><br />
84 <input type="password" name="password" placeholder="********" required><br />
85
86 <button type="submit" id="submitbutton">Import Franz account</button>
87 <small>
88 By importing your Franz account, you accept the <a href="/terms">Terms of service</a> and <a href="privacy">Privacy policy</a>
89 </small>
90 </form>
91
92 <script src="js/new.js"></script>
93</body>
94
95</html>
diff --git a/public/index.html b/public/index.html
deleted file mode 100644
index ee9ff44..0000000
--- a/public/index.html
+++ /dev/null
@@ -1,49 +0,0 @@
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <title>ferdi-server</title>
9
10 <link rel="stylesheet" href="css/vanilla.css">
11
12 <style>
13 ol,
14 p {
15 margin: 0.5rem 0;
16 }
17
18 </style>
19</head>
20
21<body>
22 <h1>ferdi-server</h1>
23
24 <p>You are accessing a custom <a href="https://github.com/kytwb/ferdi">Ferdi</a> server.</p>
25 <p>
26 To use this server in your Ferdi client, <a href="ferdi://settings/app">open Ferdi's settings</a> and as the <code>server</code>, enter <code id="server"></code>
27 </p>
28 <p>
29 Alternatively, you can manage your account in the <a href="/user/account">account dashboard</a>.
30 </p>
31
32 <br />
33 <small>
34 <a href="https://github.com/vantezzen/ferdi-server">ferdi-server</a> is a project by <a href="https://vantezzen.io">vantezzen</a>.
35 </small>
36
37 <script>
38 // Get server URL for current location
39 let server = location.href.replace('/index.html', '');
40 if (server[server.length - 1] == '/') {
41 server = server.substr(0, server.length - 1)
42 }
43
44 // Show on page
45 document.getElementById('server').innerText = server;
46 </script>
47</body>
48
49</html>
diff --git a/public/new.html b/public/new.html
deleted file mode 100644
index c11da47..0000000
--- a/public/new.html
+++ /dev/null
@@ -1,115 +0,0 @@
1<!DOCTYPE html>
2<html lang="en">
3
4<head>
5 <meta charset="UTF-8">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 <title>Create a new service</title>
9
10 <link rel="stylesheet" href="css/vanilla.css">
11
12 <style>
13 input {
14 margin-bottom: 1rem;
15 width: 100%;
16 padding: 0.5rem;
17 }
18
19 button {
20 display: flex;
21 overflow: hidden;
22 padding: 12px 12px;
23 cursor: pointer;
24 width: 100%;
25 -webkit-user-select: none;
26 -moz-user-select: none;
27 -ms-user-select: none;
28 user-select: none;
29 transition: all 150ms linear;
30 text-align: center;
31 white-space: nowrap;
32 text-decoration: none !important;
33 text-transform: none;
34 text-transform: capitalize;
35 color: #fff;
36 border: 0 none;
37 border-radius: 4px;
38 font-size: 13px;
39 font-weight: 500;
40 line-height: 1.3;
41 -webkit-appearance: none;
42 -moz-appearance: none;
43 appearance: none;
44 justify-content: center;
45 align-items: center;
46 flex: 0 0 160px;
47 box-shadow: 2px 5px 10px #e4e4e4;
48 color: #FFFFFF;
49 background: #161616;
50 }
51
52 #dropzone {
53 width: 100%;
54 height: 30vh;
55 background-color: #ebebeb;
56
57 display: flex;
58 align-items: center;
59 justify-content: center;
60 text-align: center;
61
62 cursor: pointer;
63 }
64
65 #dropzone p {
66 font-size: 0.85rem;
67 }
68
69 #files {
70 display: none;
71 }
72
73 </style>
74</head>
75
76<body>
77 <h1>Create a new recipe</h1>
78 <p>Please create a recipe using <a href="https://github.com/meetfranz/plugins/blob/master/docs/integration.md">the
79 official Franz guide</a>, then publish it here.</p>
80 <form action="new" method="post" enctype="multipart/form-data">
81 <label for="author">Author</label><br />
82 <input type="text" name="author" placeholder="Jon Doe" required><br />
83
84 <label for="name">Name</label><br />
85 <input type="text" name="name" placeholder="Sample Service" required><br />
86
87 <label for="id">Service ID</label><br />
88 <input type="text" name="id" placeholder="sample-service" required><br />
89
90 <label for="png">Link to PNG image*</label><br />
91 <input type="text" name="png" placeholder="https://.../logo.png" required><br />
92
93 <label for="svg">Link to SVG image*</label><br />
94 <input type="text" name="svg" placeholder="https://.../logo.svg" required><br />
95 *These images must be publicly availible and have CORS enabled in order to work.<br /><br />
96
97 <label for="package">Recipe files</label><br />
98 <div id="dropzone" effectAllowed="move">
99 <div>
100 Drop recipe files here<br />or click here to select files
101 <p>
102 Drag and drop your recipe files into this area.<br />
103 Please do not select the folder that contains the files but rather the files itself.
104 </p>
105 </div>
106 </div>
107 <input type="file" name="files[]" id="files" value="" multiple required><br /><br />
108
109 <button type="submit" id="submitbutton">Create recipe</button>
110 </form>
111
112 <script src="js/new.js"></script>
113</body>
114
115</html>
diff --git a/resources/views/others/import.edge b/resources/views/others/import.edge
new file mode 100644
index 0000000..b890bbb
--- /dev/null
+++ b/resources/views/others/import.edge
@@ -0,0 +1,19 @@
1@layout('layouts.main')
2
3@section('content')
4<h1>Import a Franz account</h1>
5<p>Please login using your Franz account. We will create a new Ferdi account with the same credentials.</p>
6<form action="import" method="post">
7 <label for="email">E-Mail address</label><br />
8 <input type="email" name="email" placeholder="joe@example.com" required><br />
9
10 <label for="password">Password</label><br />
11 <input type="password" name="password" placeholder="********" required><br />
12
13 <button type="submit" id="submitbutton">Import Franz account</button>
14 <small>
15 By importing your Franz account, you accept the <a href="/terms">Terms of service</a> and <a href="/privacy">Privacy
16 policy</a>
17 </small>
18</form>
19@endsection
diff --git a/resources/views/others/index.edge b/resources/views/others/index.edge
new file mode 100644
index 0000000..c594d31
--- /dev/null
+++ b/resources/views/others/index.edge
@@ -0,0 +1,38 @@
1@layout('layouts.main')
2
3@section('content')
4<style>
5 ol,
6 p {
7 margin: 0.5rem 0;
8 }
9
10</style>
11<h1>ferdi-server</h1>
12<p>You are accessing a custom <a href="https://github.com/kytwb/ferdi">Ferdi</a> server.</p>
13<p>
14 To use this server in your Ferdi client, <a href="ferdi://settings/app">open Ferdi's settings</a> and as the
15 <code>server</code>, enter <code id="server"></code>
16</p>
17<p>
18 Alternatively, you can manage your account in the <a href="/user/account">account dashboard</a>.
19</p>
20
21<br />
22<small>
23 <a href="https://github.com/vantezzen/ferdi-server">ferdi-server</a> is a project by <a
24 href="https://vantezzen.io">vantezzen</a>.
25</small>
26
27<script>
28 // Get server URL for current location
29 let server = location.href.replace('/index.html', '');
30 if (server[server.length - 1] == '/') {
31 server = server.substr(0, server.length - 1)
32 }
33
34 // Show on page
35 document.getElementById('server').innerText = server;
36
37</script>
38@endsection
diff --git a/resources/views/others/new.edge b/resources/views/others/new.edge
new file mode 100644
index 0000000..1b54558
--- /dev/null
+++ b/resources/views/others/new.edge
@@ -0,0 +1,40 @@
1@layout('layouts.main')
2
3@section('content')
4<h1>Create a new recipe</h1>
5<p>Please create a recipe using <a href="https://github.com/meetfranz/plugins/blob/master/docs/integration.md">the
6 official Franz guide</a>, then publish it here.</p>
7<form action="new" method="post" enctype="multipart/form-data">
8 <label for="author">Author</label><br />
9 <input type="text" name="author" placeholder="Jon Doe" required><br />
10
11 <label for="name">Name</label><br />
12 <input type="text" name="name" placeholder="Sample Service" required><br />
13
14 <label for="id">Service ID</label><br />
15 <input type="text" name="id" placeholder="sample-service" required><br />
16
17 <label for="png">Link to PNG image*</label><br />
18 <input type="text" name="png" placeholder="https://.../logo.png" required><br />
19
20 <label for="svg">Link to SVG image*</label><br />
21 <input type="text" name="svg" placeholder="https://.../logo.svg" required><br />
22 *These images must be publicly availible and have CORS enabled in order to work.<br /><br />
23
24 <label for="package">Recipe files</label><br />
25 <div id="dropzone" effectAllowed="move">
26 <div>
27 Drop recipe files here<br />or click here to select files
28 <p>
29 Drag and drop your recipe files into this area.<br />
30 Please do not select the folder that contains the files but rather the files itself.
31 </p>
32 </div>
33 </div>
34 <input type="file" name="files[]" id="files" value="" multiple required><br /><br />
35
36 <button type="submit" id="submitbutton">Create recipe</button>
37</form>
38
39<script src="js/new.js"></script>
40@endsection
diff --git a/start/routes.js b/start/routes.js
index d857ce9..5cf9fda 100644
--- a/start/routes.js
+++ b/start/routes.js
@@ -83,20 +83,24 @@ Route.group(() => {
83 83
84// Recipe creation 84// Recipe creation
85Route.post('new', 'RecipeController.create') 85Route.post('new', 'RecipeController.create')
86Route.get('new', ({ response }) => { 86Route.get('new', ({ response, view }) => {
87 if (Env.get('IS_CREATION_ENABLED') == 'false') { 87 if (Env.get('IS_CREATION_ENABLED') == 'false') {
88 return response.send('This server doesn\'t allow the creation of new recipes.\n\nIf you are the server owner, please set IS_CREATION_ENABLED to true to enable recipe creation.'); 88 return response.send('This server doesn\'t allow the creation of new recipes.\n\nIf you are the server owner, please set IS_CREATION_ENABLED to true to enable recipe creation.');
89 } else { 89 } else {
90 return response.redirect('/new.html') 90 return view.render('others.new')
91 } 91 }
92}) 92})
93 93
94// Franz account import 94// Franz account import
95Route.post('import', 'UserController.import') 95Route.post('import', 'UserController.import')
96Route.get('import', ({ response }) => response.redirect('/import.html')) 96Route.get('import', ({ view }) => view.render('others.import'))
97 97
98// Legal documents 98// Legal documents
99Route.get('terms', ({ response }) => response.redirect('/terms.html')) 99Route.get('terms', ({ response }) => response.redirect('/terms.html'))
100Route.get('privacy', ({ response }) => response.redirect('/privacy.html')) 100Route.get('privacy', ({ response }) => response.redirect('/privacy.html'))
101 101
102Route.get('/', ({ response }) => response.redirect('/index.html')) 102// Index
103Route.get('/', ({ view }) => view.render('others.index'))
104
105// 404 handler
106Route.get('/*', ({ response }) => response.redirect('/')) \ No newline at end of file