@silexlabs/silex 3.0.0-alpha.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.default +19 -0
- package/.silex.js +37 -0
- package/LICENSE +661 -0
- package/README.md +96 -0
- package/dist/client/client/api.d.ts +85 -0
- package/dist/client/client/assetUrl.d.ts +51 -0
- package/dist/client/client/config.d.ts +58 -0
- package/dist/client/client/events.d.ts +14 -0
- package/dist/client/client/expose.d.ts +8 -0
- package/dist/client/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/client/client/grapesjs/PublicationManager.d.ts +72 -0
- package/dist/client/client/grapesjs/PublicationUi.d.ts +62 -0
- package/dist/client/client/grapesjs/blocks.d.ts +1 -0
- package/dist/client/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/client/client/grapesjs/footer.d.ts +2 -0
- package/dist/client/client/grapesjs/index.d.ts +5 -0
- package/dist/client/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/client/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/client/client/grapesjs/openImport.d.ts +9 -0
- package/dist/client/client/grapesjs/page-panel.d.ts +3 -0
- package/dist/client/client/grapesjs/project-bar.d.ts +1 -0
- package/dist/client/client/grapesjs/rich-text.d.ts +1 -0
- package/dist/client/client/grapesjs/semantic.d.ts +1 -0
- package/dist/client/client/grapesjs/settings.d.ts +2 -0
- package/dist/client/client/grapesjs/storage.d.ts +1 -0
- package/dist/client/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/client/client/index.d.ts +5 -0
- package/dist/client/client/publication-transformers.d.ts +41 -0
- package/dist/client/client/utils.d.ts +2 -0
- package/dist/client/constants.d.ts +29 -0
- package/dist/client/css/admin.css +4491 -0
- package/dist/client/index.html +9 -0
- package/dist/client/js/main.js +321 -0
- package/dist/client/js/main.js.LICENSE.txt +24 -0
- package/dist/client/page.d.ts +2 -0
- package/dist/client/types.d.ts +334 -0
- package/dist/plugins/client/client/api.d.ts +85 -0
- package/dist/plugins/client/client/api.js +114 -0
- package/dist/plugins/client/client/api.js.map +1 -0
- package/dist/plugins/client/client/assetUrl.d.ts +51 -0
- package/dist/plugins/client/client/assetUrl.js +224 -0
- package/dist/plugins/client/client/assetUrl.js.map +1 -0
- package/dist/plugins/client/client/config.d.ts +58 -0
- package/dist/plugins/client/client/config.js +90 -0
- package/dist/plugins/client/client/config.js.map +1 -0
- package/dist/plugins/client/client/events.d.ts +14 -0
- package/dist/plugins/client/client/events.js +34 -0
- package/dist/plugins/client/client/events.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.js +195 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.d.ts +72 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.js +356 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.d.ts +62 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.js +336 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/blocks.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/blocks.js +37 -0
- package/dist/plugins/client/client/grapesjs/blocks.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/breadcrumbs.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/breadcrumbs.js +75 -0
- package/dist/plugins/client/client/grapesjs/breadcrumbs.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/footer.d.ts +2 -0
- package/dist/plugins/client/client/grapesjs/footer.js +28 -0
- package/dist/plugins/client/client/grapesjs/footer.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/index.d.ts +5 -0
- package/dist/plugins/client/client/grapesjs/index.js +313 -0
- package/dist/plugins/client/client/grapesjs/index.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/internal-links.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/internal-links.js +219 -0
- package/dist/plugins/client/client/grapesjs/internal-links.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/new-page-dialog.d.ts +2 -0
- package/dist/plugins/client/client/grapesjs/new-page-dialog.js +83 -0
- package/dist/plugins/client/client/grapesjs/new-page-dialog.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/openImport.d.ts +9 -0
- package/dist/plugins/client/client/grapesjs/openImport.js +74 -0
- package/dist/plugins/client/client/grapesjs/openImport.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/page-panel.d.ts +3 -0
- package/dist/plugins/client/client/grapesjs/page-panel.js +113 -0
- package/dist/plugins/client/client/grapesjs/page-panel.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/project-bar.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/project-bar.js +104 -0
- package/dist/plugins/client/client/grapesjs/project-bar.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/rich-text.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/rich-text.js +31 -0
- package/dist/plugins/client/client/grapesjs/rich-text.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/semantic.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/semantic.js +110 -0
- package/dist/plugins/client/client/grapesjs/semantic.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/settings.d.ts +2 -0
- package/dist/plugins/client/client/grapesjs/settings.js +198 -0
- package/dist/plugins/client/client/grapesjs/settings.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/storage.d.ts +1 -0
- package/dist/plugins/client/client/grapesjs/storage.js +126 -0
- package/dist/plugins/client/client/grapesjs/storage.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/symbolDialogs.d.ts +3 -0
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js +36 -0
- package/dist/plugins/client/client/grapesjs/symbolDialogs.js.map +1 -0
- package/dist/plugins/client/client/publication-transformers.d.ts +41 -0
- package/dist/plugins/client/client/publication-transformers.js +238 -0
- package/dist/plugins/client/client/publication-transformers.js.map +1 -0
- package/dist/plugins/client/client/utils.d.ts +2 -0
- package/dist/plugins/client/client/utils.js +25 -0
- package/dist/plugins/client/client/utils.js.map +1 -0
- package/dist/plugins/client/constants.d.ts +29 -0
- package/dist/plugins/client/constants.js +46 -0
- package/dist/plugins/client/constants.js.map +1 -0
- package/dist/plugins/client/page.d.ts +2 -0
- package/dist/plugins/client/page.js +31 -0
- package/dist/plugins/client/page.js.map +1 -0
- package/dist/plugins/client/plugins/client/11ty.d.ts +17 -0
- package/dist/plugins/client/plugins/client/11ty.js +86 -0
- package/dist/plugins/client/plugins/client/11ty.js.map +1 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.d.ts +2 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js +170 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js.map +1 -0
- package/dist/plugins/client/plugins/client/template.d.ts +2 -0
- package/dist/plugins/client/plugins/client/template.js +183 -0
- package/dist/plugins/client/plugins/client/template.js.map +1 -0
- package/dist/plugins/client/plugins/client/website-info.d.ts +1 -0
- package/dist/plugins/client/plugins/client/website-info.js +72 -0
- package/dist/plugins/client/plugins/client/website-info.js.map +1 -0
- package/dist/plugins/client/types.d.ts +334 -0
- package/dist/plugins/client/types.js +74 -0
- package/dist/plugins/client/types.js.map +1 -0
- package/dist/plugins/server/constants.d.ts +29 -0
- package/dist/plugins/server/constants.js +49 -0
- package/dist/plugins/server/constants.js.map +1 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js +40 -0
- package/dist/plugins/server/plugins/server/AuthPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/Cache.d.ts +2 -0
- package/dist/plugins/server/plugins/server/Cache.js +32 -0
- package/dist/plugins/server/plugins/server/Cache.js.map +1 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.d.ts +29 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.js +129 -0
- package/dist/plugins/server/plugins/server/DownloadConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +86 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js +526 -0
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +87 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js +564 -0
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.d.ts +0 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js +14 -0
- package/dist/plugins/server/plugins/server/PublicationOptimizer.js.map +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js +86 -0
- package/dist/plugins/server/plugins/server/SslPlugin.js.map +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.d.ts +1 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js +78 -0
- package/dist/plugins/server/plugins/server/StaticPlugin.js.map +1 -0
- package/dist/plugins/server/server/config.d.ts +59 -0
- package/dist/plugins/server/server/config.js +181 -0
- package/dist/plugins/server/server/config.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +13 -0
- package/dist/plugins/server/server/connectors/FsHosting.js +54 -0
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -0
- package/dist/plugins/server/server/connectors/FsStorage.d.ts +43 -0
- package/dist/plugins/server/server/connectors/FsStorage.js +257 -0
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -0
- package/dist/plugins/server/server/connectors/connectors.d.ts +87 -0
- package/dist/plugins/server/server/connectors/connectors.js +127 -0
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -0
- package/dist/plugins/server/server/events.d.ts +26 -0
- package/dist/plugins/server/server/events.js +31 -0
- package/dist/plugins/server/server/events.js.map +1 -0
- package/dist/plugins/server/server/jobs.d.ts +12 -0
- package/dist/plugins/server/server/jobs.js +77 -0
- package/dist/plugins/server/server/jobs.js.map +1 -0
- package/dist/plugins/server/server/utils/validation.d.ts +7 -0
- package/dist/plugins/server/server/utils/validation.js +38 -0
- package/dist/plugins/server/server/utils/validation.js.map +1 -0
- package/dist/plugins/server/types.d.ts +334 -0
- package/dist/plugins/server/types.js +78 -0
- package/dist/plugins/server/types.js.map +1 -0
- package/dist/server/constants.js +29 -0
- package/dist/server/plugins/server/Cache.js +15 -0
- package/dist/server/server/api/api.js +20 -0
- package/dist/server/server/api/connectorApi.js +216 -0
- package/dist/server/server/api/publicationApi.js +108 -0
- package/dist/server/server/api/websiteApi.js +296 -0
- package/dist/server/server/cli.js +68 -0
- package/dist/server/server/config.js +120 -0
- package/dist/server/server/connectors/FsHosting.js +35 -0
- package/dist/server/server/connectors/FsStorage.js +225 -0
- package/dist/server/server/connectors/connectors.js +89 -0
- package/dist/server/server/events.js +14 -0
- package/dist/server/server/expose.js +27 -0
- package/dist/server/server/express.js +47 -0
- package/dist/server/server/index.js +90 -0
- package/dist/server/server/jobs.js +48 -0
- package/dist/server/server/utils/validation.js +15 -0
- package/dist/server/types.js +34 -0
- package/package.json +209 -0
- package/public/assets/container.png +0 -0
- package/public/assets/favicon.png +0 -0
- package/public/assets/logo-silex-small.png +0 -0
- package/public/robots.txt +2 -0
- package/public/silex.js +24 -0
- package/src/css/_mixins.scss +8 -0
- package/src/css/_variables.scss +33 -0
- package/src/css/dialog.scss +41 -0
- package/src/css/footer.scss +12 -0
- package/src/css/grapesjs-light.scss +180 -0
- package/src/css/grapesjs.scss +152 -0
- package/src/css/index.scss +32 -0
- package/src/css/light.scss +7 -0
- package/src/css/loader.scss +12 -0
- package/src/css/page-panel.scss +65 -0
- package/src/css/project-bar.scss +102 -0
- package/src/css/silex.scss +189 -0
- package/src/css/website-info.scss +14 -0
- package/src/html/debug.pug +8 -0
- package/src/html/index.pug +39 -0
- package/src/html/templates/includes.pug +1 -0
- package/src/html/templates/workspace.pug +2 -0
- package/src/ts/client/api.ts +144 -0
- package/src/ts/client/assetUrl.test.ts +125 -0
- package/src/ts/client/assetUrl.ts +235 -0
- package/src/ts/client/config.ts +105 -0
- package/src/ts/client/events.ts +34 -0
- package/src/ts/client/expose.ts +30 -0
- package/src/ts/client/grapesjs/LoginDialog.ts +204 -0
- package/src/ts/client/grapesjs/PublicationManager.ts +370 -0
- package/src/ts/client/grapesjs/PublicationUi.ts +342 -0
- package/src/ts/client/grapesjs/blocks.ts +37 -0
- package/src/ts/client/grapesjs/breadcrumbs.ts +79 -0
- package/src/ts/client/grapesjs/eleventy.ts +47 -0
- package/src/ts/client/grapesjs/footer.ts +27 -0
- package/src/ts/client/grapesjs/index.ts +335 -0
- package/src/ts/client/grapesjs/internal-links.test.ts +105 -0
- package/src/ts/client/grapesjs/internal-links.ts +225 -0
- package/src/ts/client/grapesjs/new-page-dialog.ts +90 -0
- package/src/ts/client/grapesjs/openImport.ts +81 -0
- package/src/ts/client/grapesjs/page-panel.ts +118 -0
- package/src/ts/client/grapesjs/project-bar.ts +107 -0
- package/src/ts/client/grapesjs/rich-text.ts +33 -0
- package/src/ts/client/grapesjs/semantic.ts +114 -0
- package/src/ts/client/grapesjs/settings.ts +208 -0
- package/src/ts/client/grapesjs/storage.ts +121 -0
- package/src/ts/client/grapesjs/symbolDialogs.ts +38 -0
- package/src/ts/client/index.ts +98 -0
- package/src/ts/client/publication-transformers.test.ts +199 -0
- package/src/ts/client/publication-transformers.ts +263 -0
- package/src/ts/client/utils.ts +28 -0
- package/src/ts/constants.ts +52 -0
- package/src/ts/externs.ts +18 -0
- package/src/ts/page.ts +31 -0
- package/src/ts/plugins/client/11ty.ts +104 -0
- package/src/ts/plugins/client/publicationRenderer.ts +174 -0
- package/src/ts/plugins/client/template.ts +192 -0
- package/src/ts/plugins/client/website-info.ts +84 -0
- package/src/ts/plugins/server/AuthPlugin.ts +38 -0
- package/src/ts/plugins/server/Cache.ts +28 -0
- package/src/ts/plugins/server/DownloadConnector.ts +148 -0
- package/src/ts/plugins/server/FtpConnector.test.ts +82 -0
- package/src/ts/plugins/server/FtpConnector.ts +609 -0
- package/src/ts/plugins/server/GitlabConnector.ts +644 -0
- package/src/ts/plugins/server/PublicationOptimizer.ts +14 -0
- package/src/ts/plugins/server/SslPlugin.ts +84 -0
- package/src/ts/plugins/server/StaticPlugin.ts +79 -0
- package/src/ts/server/api/api.ts +19 -0
- package/src/ts/server/api/connectorApi.ts +345 -0
- package/src/ts/server/api/publicationApi.ts +159 -0
- package/src/ts/server/api/websiteApi.ts +432 -0
- package/src/ts/server/cli.ts +65 -0
- package/src/ts/server/config.ts +189 -0
- package/src/ts/server/connectors/FsHosting.ts +60 -0
- package/src/ts/server/connectors/FsStorage.test.ts +51 -0
- package/src/ts/server/connectors/FsStorage.ts +261 -0
- package/src/ts/server/connectors/connectors.ts +203 -0
- package/src/ts/server/events.ts +37 -0
- package/src/ts/server/expose.ts +19 -0
- package/src/ts/server/express.ts +70 -0
- package/src/ts/server/index.ts +100 -0
- package/src/ts/server/jobs.test.ts +75 -0
- package/src/ts/server/jobs.ts +87 -0
- package/src/ts/server/utils/BackwardCompat.ts +552 -0
- package/src/ts/server/utils/validation.ts +34 -0
- package/src/ts/types.ts +339 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
@use "mixins";
|
|
3
|
+
|
|
4
|
+
.silex-workspace {
|
|
5
|
+
@include mixins.silex-ui-full;
|
|
6
|
+
body {
|
|
7
|
+
font-family: $fontFamily;
|
|
8
|
+
}
|
|
9
|
+
display: flex;
|
|
10
|
+
a {
|
|
11
|
+
color: inherit;
|
|
12
|
+
}
|
|
13
|
+
h2 {
|
|
14
|
+
font-size: 18px;
|
|
15
|
+
background: $lighterPrimaryColor;
|
|
16
|
+
border-radius: 8px 8px 0 0;
|
|
17
|
+
padding: 8px;
|
|
18
|
+
margin: 0;
|
|
19
|
+
font-weight: normal;
|
|
20
|
+
}
|
|
21
|
+
h3 {
|
|
22
|
+
margin: 10px 0;
|
|
23
|
+
font-size: 18px;
|
|
24
|
+
font-weight: normal;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.full-width {
|
|
29
|
+
width: 100%;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// full screen settings
|
|
33
|
+
.settings-dialog > div {
|
|
34
|
+
max-width: none;
|
|
35
|
+
width: 100%;
|
|
36
|
+
max-height: 100vh;
|
|
37
|
+
overflow: auto;
|
|
38
|
+
form.silex-form {
|
|
39
|
+
padding-bottom: 100px; // leave space for fixed footer
|
|
40
|
+
textarea {
|
|
41
|
+
min-height: 250px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
.silex-form__element {
|
|
45
|
+
padding: 10px 5px;
|
|
46
|
+
border: 1px solid $lighterPrimaryColor;
|
|
47
|
+
margin: 10px 0;
|
|
48
|
+
width: 98%;
|
|
49
|
+
}
|
|
50
|
+
footer {
|
|
51
|
+
position: fixed;
|
|
52
|
+
bottom: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
width: 100%;
|
|
55
|
+
padding: 20px 0;
|
|
56
|
+
background-color: $primaryColor;
|
|
57
|
+
&>*:last-child {
|
|
58
|
+
margin-right: 30px;
|
|
59
|
+
}
|
|
60
|
+
.silex-version {
|
|
61
|
+
float: left;
|
|
62
|
+
padding: 0 15px;
|
|
63
|
+
font-size: x-small;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
button.silex-button,
|
|
69
|
+
input.silex-button[type="button"],
|
|
70
|
+
input.silex-button[type="submit"] {
|
|
71
|
+
cursor: pointer;
|
|
72
|
+
font-family: inherit;
|
|
73
|
+
color: #fff;
|
|
74
|
+
display: inline-flex;
|
|
75
|
+
align-items: center;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
border: 1px solid #e9ebeb;
|
|
78
|
+
border-bottom-color: #e1e3e3;
|
|
79
|
+
border-radius: 4px;
|
|
80
|
+
box-shadow: 0 2px 4px 0 rgba(14, 30, 37, .12);
|
|
81
|
+
background-color: $lighterPrimaryColor;
|
|
82
|
+
border-color: transparent;
|
|
83
|
+
padding: 5px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.silex-button[disabled] {
|
|
87
|
+
opacity: .8;
|
|
88
|
+
cursor: unset;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.silex-button.silex-button--primary {
|
|
92
|
+
background-color: $lighterPrimaryColor;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.silex-button.silex-button--secondary {
|
|
96
|
+
background-color: $primaryColor;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.silex-button--size {
|
|
100
|
+
max-height: 30px;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.silex-button--small {
|
|
104
|
+
font-size: .7em;
|
|
105
|
+
padding: 0 5px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.silex-input {
|
|
109
|
+
appearance: initial;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.silex-label {
|
|
113
|
+
display: block;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.silex-bar {
|
|
117
|
+
display: flex;
|
|
118
|
+
&>* {
|
|
119
|
+
margin: 5px;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
ol.silex-list,
|
|
124
|
+
ul.silex-list {
|
|
125
|
+
list-style: none;
|
|
126
|
+
margin: 0;
|
|
127
|
+
padding: 0;
|
|
128
|
+
background-color: #575757;
|
|
129
|
+
&>li {
|
|
130
|
+
padding: 5px;
|
|
131
|
+
border-bottom: 1px solid #575757;
|
|
132
|
+
background-color: #444;
|
|
133
|
+
margin: 5px;
|
|
134
|
+
}
|
|
135
|
+
fieldset {
|
|
136
|
+
border-color: #575757;
|
|
137
|
+
}
|
|
138
|
+
h4 { // badge-like
|
|
139
|
+
display: inline-block;
|
|
140
|
+
padding: 5px;
|
|
141
|
+
padding-bottom: 2px;
|
|
142
|
+
margin: 10px 5px;
|
|
143
|
+
font-weight: normal;
|
|
144
|
+
color: #3d3d3d;
|
|
145
|
+
background-color: #c4c4c4;
|
|
146
|
+
}
|
|
147
|
+
.silex-list__item__body {
|
|
148
|
+
display: flex;
|
|
149
|
+
}
|
|
150
|
+
.silex-list__item__footer {
|
|
151
|
+
display: flex;
|
|
152
|
+
justify-content: flex-end;
|
|
153
|
+
button {
|
|
154
|
+
padding: 5px;
|
|
155
|
+
margin: 5px;
|
|
156
|
+
padding-top: 8px;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
form.silex-form {
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
footer {
|
|
165
|
+
text-align: right;
|
|
166
|
+
border-top: 1px solid $lighterPrimaryColor;
|
|
167
|
+
padding: 20px 0 10px;
|
|
168
|
+
margin: 20px 0 0;
|
|
169
|
+
}
|
|
170
|
+
button, input, optgroup, select, textarea {
|
|
171
|
+
background-color: $darkerPrimaryColor;
|
|
172
|
+
color: $secondaryColor;
|
|
173
|
+
padding: 5px;
|
|
174
|
+
border: none;
|
|
175
|
+
}
|
|
176
|
+
input[type=checkbox] {
|
|
177
|
+
margin: 5px;
|
|
178
|
+
}
|
|
179
|
+
textarea {
|
|
180
|
+
width: 98% !important;
|
|
181
|
+
}
|
|
182
|
+
.silex-form__element {
|
|
183
|
+
display: inline-flex;
|
|
184
|
+
flex-direction: column;
|
|
185
|
+
}
|
|
186
|
+
.silex-form__group.col2 {
|
|
187
|
+
column-count: 2;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
@use "variables" as *;
|
|
2
|
+
|
|
3
|
+
.gjs-website-meta {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: center;
|
|
6
|
+
justify-content: center;
|
|
7
|
+
margin-left: 10px;
|
|
8
|
+
margin-right: 10px;
|
|
9
|
+
padding: 0 10px;
|
|
10
|
+
line-height: 1;
|
|
11
|
+
min-width: 100px;
|
|
12
|
+
border: 1px solid $lighterPrimaryColor;
|
|
13
|
+
background-color: $darkerPrimaryColor;
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
doctype html
|
|
2
|
+
html(lang="en", translate="no")
|
|
3
|
+
head
|
|
4
|
+
block head-start
|
|
5
|
+
|
|
6
|
+
block head
|
|
7
|
+
title='Silex'
|
|
8
|
+
meta(name='description', content='This is a public instance of Silex website builder. Build websites in the browser')
|
|
9
|
+
link(rel="shortcut icon", href="assets/favicon.png")
|
|
10
|
+
|
|
11
|
+
block loading
|
|
12
|
+
style.
|
|
13
|
+
body {
|
|
14
|
+
background-color: #444444;
|
|
15
|
+
font-family: "Ubuntu", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
16
|
+
}
|
|
17
|
+
.silex-loader {
|
|
18
|
+
display: none;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
block head-end
|
|
22
|
+
|
|
23
|
+
body.silex-loading
|
|
24
|
+
.silex-loader.silex-dialog.
|
|
25
|
+
Loading...
|
|
26
|
+
|
|
27
|
+
block includes
|
|
28
|
+
include ./templates/includes.pug
|
|
29
|
+
|
|
30
|
+
block body-start
|
|
31
|
+
include ./templates/workspace.pug
|
|
32
|
+
|
|
33
|
+
block body-end
|
|
34
|
+
script(src='js/main.js')
|
|
35
|
+
|
|
36
|
+
block silex-start
|
|
37
|
+
// Here you can use silex.config to hook into silex options before silex starts
|
|
38
|
+
script.
|
|
39
|
+
window.silex.start()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
link(rel='stylesheet', type='text/css', href='css/admin.css')
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Silex website builder, free/libre no-code tool for makers.
|
|
3
|
+
* Copyright (c) 2023 lexoyo and Silex Labs foundation
|
|
4
|
+
*
|
|
5
|
+
* This program is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Affero General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or any later version.
|
|
8
|
+
*
|
|
9
|
+
* This program is distributed in the hope that it will be useful,
|
|
10
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
* GNU Affero General Public License for more details.
|
|
13
|
+
*
|
|
14
|
+
* You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { API_CONNECTOR_LIST, API_CONNECTOR_USER, API_CONNECTOR_LOGOUT, API_CONNECTOR_PATH, API_PATH, API_PUBLICATION_PATH, API_PUBLICATION_PUBLISH, API_PUBLICATION_STATUS, API_WEBSITE_ASSET_READ, API_WEBSITE_ASSETS_WRITE, API_WEBSITE_DELETE, API_WEBSITE_LIST, API_WEBSITE_PATH, API_WEBSITE_READ, API_WEBSITE_WRITE, API_WEBSITE_META_READ, API_WEBSITE_META_WRITE, API_WEBSITE_CREATE } from '../constants'
|
|
19
|
+
import { ApiPublicationPublishBody, ApiPublicationPublishQuery, ApiPublicationPublishResponse, ApiPublicationStatusQuery, ApiPublicationStatusResponse, ConnectorId, JobData, JobId, PublicationJobData, WebsiteId, ApiConnectorListResponse, ApiConnectorListQuery, ConnectorData, ConnectorType, ApiWebsiteReadQuery, ApiWebsiteReadResponse, WebsiteData, ApiWebsiteWriteQuery, ApiWebsiteWriteBody, ApiWebsiteWriteResponse, ApiWebsiteDeleteQuery, ApiWebsiteAssetsReadQuery, ApiWebsiteAssetsReadResponse, ApiWebsiteAssetsWriteQuery, ApiWebsiteAssetsWriteBody, ApiWebsiteAssetsWriteResponse, ClientSideFile, PublicationData, ApiConnectorUserResponse, ConnectorUser, WebsiteMeta, ApiConnectorLogoutQuery, ApiConnectorUserQuery, ApiWebsiteListResponse, ApiWebsiteListQuery, WebsiteMetaFileContent, ApiWebsiteCreateQuery, ApiWebsiteCreateBody, ApiWebsiteCreateResponse, ApiWebsiteMetaWriteQuery, ApiWebsiteMetaWriteBody, ApiWebsiteMetaWriteResponse, ApiWebsiteMetaReadQuery, ApiWebsiteMetaReadResponse, ConnectorOptions, ApiError } from '../types'
|
|
20
|
+
|
|
21
|
+
export enum ApiRoute {
|
|
22
|
+
PUBLICATION_PUBLISH = API_PATH + API_PUBLICATION_PATH + API_PUBLICATION_PUBLISH,
|
|
23
|
+
PUBLICATION_STATUS = API_PATH + API_PUBLICATION_PATH + API_PUBLICATION_STATUS,
|
|
24
|
+
CONNECTOR_USER = API_PATH + API_CONNECTOR_PATH + API_CONNECTOR_USER,
|
|
25
|
+
CONNECTOR_LOGOUT = API_PATH + API_CONNECTOR_PATH + API_CONNECTOR_LOGOUT,
|
|
26
|
+
CONNECTOR_LIST = API_PATH + API_CONNECTOR_PATH + API_CONNECTOR_LIST,
|
|
27
|
+
WEBSITE_READ = API_PATH + API_WEBSITE_PATH + API_WEBSITE_READ,
|
|
28
|
+
WEBSITE_WRITE = API_PATH + API_WEBSITE_PATH + API_WEBSITE_WRITE,
|
|
29
|
+
WEBSITE_DELETE = API_PATH + API_WEBSITE_PATH + API_WEBSITE_DELETE,
|
|
30
|
+
WEBSITE_CREATE = API_PATH + API_WEBSITE_PATH + API_WEBSITE_CREATE,
|
|
31
|
+
WEBSITE_LIST = API_PATH + API_WEBSITE_PATH + API_WEBSITE_LIST,
|
|
32
|
+
WEBSITE_ASSETS_READ = API_PATH + API_WEBSITE_PATH + API_WEBSITE_ASSET_READ,
|
|
33
|
+
WEBSITE_ASSETS_WRITE = API_PATH + API_WEBSITE_PATH + API_WEBSITE_ASSETS_WRITE,
|
|
34
|
+
WEBSITE_META_READ = API_PATH + API_WEBSITE_PATH + API_WEBSITE_META_READ,
|
|
35
|
+
WEBSITE_META_WRITE = API_PATH + API_WEBSITE_PATH + API_WEBSITE_META_WRITE,
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Root URL of Silex server, should we use config.rootUrl ?
|
|
39
|
+
let serverUrl = window.location.origin + window.location.pathname.replace(/\/$/, '')
|
|
40
|
+
export function setServerUrl(url: string): void {
|
|
41
|
+
serverUrl = url
|
|
42
|
+
}
|
|
43
|
+
export function getServerUrl(): string {
|
|
44
|
+
return serverUrl
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export async function getUser({type, connectorId}: {type: ConnectorType, connectorId?: ConnectorId}): Promise<ConnectorUser> {
|
|
48
|
+
return api<ApiConnectorUserQuery, null, ApiConnectorUserResponse>(ApiRoute.CONNECTOR_USER, 'GET', {
|
|
49
|
+
type,
|
|
50
|
+
connectorId,
|
|
51
|
+
}) as Promise<ConnectorUser>
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export async function logout({type, connectorId}: {type: ConnectorType, connectorId?: ConnectorId}): Promise<void> {
|
|
55
|
+
return api<ApiConnectorLogoutQuery, null, null>(ApiRoute.CONNECTOR_LOGOUT, 'POST', { connectorId, type })
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export async function publish({websiteId, hostingId, storageId, data, options}: {websiteId: WebsiteId, hostingId: ConnectorId, storageId: ConnectorId, data: PublicationData, options: ConnectorOptions}): Promise<[url: string, job: PublicationJobData]> {
|
|
59
|
+
const { url, job } = await api<ApiPublicationPublishQuery, ApiPublicationPublishBody, ApiPublicationPublishResponse>(
|
|
60
|
+
ApiRoute.PUBLICATION_PUBLISH,
|
|
61
|
+
'POST',
|
|
62
|
+
{ websiteId, hostingId, storageId, options },
|
|
63
|
+
data
|
|
64
|
+
) as ApiPublicationPublishResponse
|
|
65
|
+
return [url, job]
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export async function publicationStatus({jobId}: {jobId: JobId}): Promise<PublicationJobData> {
|
|
69
|
+
return api<ApiPublicationStatusQuery, null, ApiPublicationStatusResponse>(
|
|
70
|
+
ApiRoute.PUBLICATION_STATUS,
|
|
71
|
+
'GET',
|
|
72
|
+
{ jobId },
|
|
73
|
+
) as Promise<PublicationJobData>
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export async function connectorList({type}: {type: ConnectorType}): Promise<ConnectorData[]> {
|
|
77
|
+
const list = await api<ApiConnectorListQuery, null, ApiConnectorListResponse>(ApiRoute.CONNECTOR_LIST, 'GET', { type })
|
|
78
|
+
return list as ConnectorData[]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export async function websiteList({connectorId}: {connectorId?: ConnectorId}): Promise<WebsiteMeta[]> {
|
|
82
|
+
return api<ApiWebsiteListQuery, null, ApiWebsiteListResponse>(ApiRoute.WEBSITE_LIST, 'GET', { connectorId }) as Promise<WebsiteMeta[]>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export async function websiteLoad({websiteId, connectorId}: {websiteId: WebsiteId, connectorId?: ConnectorId}): Promise<WebsiteData> {
|
|
86
|
+
return api<ApiWebsiteReadQuery, null, ApiWebsiteReadResponse>(ApiRoute.WEBSITE_READ, 'GET', { websiteId, connectorId: connectorId }) as Promise<WebsiteData>
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export async function websiteSave({websiteId, data, connectorId}: {websiteId: WebsiteId, data: WebsiteData, connectorId?: ConnectorId}): Promise<void> {
|
|
90
|
+
const { message } = await api<ApiWebsiteWriteQuery, ApiWebsiteWriteBody, ApiWebsiteWriteResponse>(ApiRoute.WEBSITE_WRITE, 'POST', { websiteId, connectorId: connectorId }, data)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export async function websiteDelete({websiteId, connectorId}: {websiteId: WebsiteId, connectorId?: ConnectorId}): Promise<void> {
|
|
94
|
+
await api<ApiWebsiteDeleteQuery, null, null>(ApiRoute.WEBSITE_DELETE, 'DELETE', { websiteId, connectorId: connectorId })
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export async function websiteCreate({websiteId, data, connectorId}: {websiteId: WebsiteId, data: WebsiteMetaFileContent, connectorId?: ConnectorId}): Promise<void> {
|
|
98
|
+
await api<ApiWebsiteCreateQuery, ApiWebsiteCreateBody, ApiWebsiteCreateResponse>(ApiRoute.WEBSITE_CREATE, 'PUT', { connectorId: connectorId }, data)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export async function websiteMetaWrite({websiteId, data, connectorId}: {websiteId: WebsiteId, data: WebsiteMetaFileContent, connectorId?: ConnectorId}): Promise<void> {
|
|
102
|
+
await api<ApiWebsiteMetaWriteQuery, ApiWebsiteMetaWriteBody, ApiWebsiteMetaWriteResponse>(ApiRoute.WEBSITE_META_WRITE, 'POST', { websiteId, connectorId: connectorId }, data)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export async function websiteMetaRead({websiteId, connectorId}: {websiteId: WebsiteId, connectorId?: ConnectorId}): Promise<WebsiteMeta> {
|
|
106
|
+
return api<ApiWebsiteMetaReadQuery, null, ApiWebsiteMetaReadResponse>(ApiRoute.WEBSITE_META_WRITE, 'GET', { websiteId, connectorId })
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export async function websiteAssetsLoad({path, websiteId, connectorId}: {path: string, websiteId: WebsiteId, connectorId: ConnectorId}): Promise<string> {
|
|
110
|
+
return api<ApiWebsiteAssetsReadQuery, null, ApiWebsiteAssetsReadResponse>(`${ApiRoute.WEBSITE_ASSETS_READ}/${path}`, 'GET', { websiteId, connectorId: connectorId })
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Not used directly, grapesjs handles the upload
|
|
115
|
+
* @see assetManager in src/ts/client/grapesjs/index.ts
|
|
116
|
+
*/
|
|
117
|
+
export async function websiteAssetsSave({websiteId, connectorId, files}: {websiteId: WebsiteId, connectorId: ConnectorId, files: ClientSideFile[]}): Promise<string[]> {
|
|
118
|
+
const { data } = await api<ApiWebsiteAssetsWriteQuery, ApiWebsiteAssetsWriteBody, ApiWebsiteAssetsWriteResponse>(ApiRoute.WEBSITE_ASSETS_WRITE, 'POST', { websiteId, connectorId: connectorId }, files)
|
|
119
|
+
return data
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export async function api<ReqQuery, ReqBody, ResBody>(route: ApiRoute | string, method: string, query?: ReqQuery, payload?: ReqBody): Promise<ResBody> {
|
|
123
|
+
const url = `${serverUrl}${route.toString()}?${
|
|
124
|
+
new URLSearchParams(
|
|
125
|
+
Object.entries(query)
|
|
126
|
+
.filter(([key, value]) => !!value)
|
|
127
|
+
.map(([key, value]) => [key, typeof value === 'string' ? value : JSON.stringify(value)])
|
|
128
|
+
).toString()}`
|
|
129
|
+
const response = await fetch(url, {
|
|
130
|
+
method,
|
|
131
|
+
headers: {
|
|
132
|
+
'Content-Type': 'application/json',
|
|
133
|
+
},
|
|
134
|
+
body: payload && JSON.stringify(payload), // assuming that the payload needs to be stringified
|
|
135
|
+
credentials: 'include', // sends the cookies with the request
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
if (!response.ok) {
|
|
139
|
+
const json = await response.json()
|
|
140
|
+
throw new ApiError(json.message, response.status)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return response.json()
|
|
144
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jest, expect, describe, it, beforeEach } from '@jest/globals'
|
|
2
|
+
|
|
3
|
+
describe('assetUrl', () => {
|
|
4
|
+
beforeEach(() => {
|
|
5
|
+
jest.resetModules()
|
|
6
|
+
Object.defineProperty(window, 'location', {
|
|
7
|
+
value: {
|
|
8
|
+
href: 'http://localhost:6800/',
|
|
9
|
+
pathname: '',
|
|
10
|
+
origin: 'http://localhost:6800',
|
|
11
|
+
},
|
|
12
|
+
})
|
|
13
|
+
Object.assign(window.location, {
|
|
14
|
+
href: 'http://localhost:6800/',
|
|
15
|
+
pathname: '',
|
|
16
|
+
origin: 'http://localhost:6800',
|
|
17
|
+
})
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it('store url to display url', async () => {
|
|
21
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
22
|
+
// Convert a valid URL as stored
|
|
23
|
+
expect(storedToDisplayed('/assets/test.webp', 'test-id', 'test-connector'))
|
|
24
|
+
.toBe('/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
25
|
+
// Convert a URL which is already as displayed
|
|
26
|
+
expect(storedToDisplayed('/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector', 'test-id', 'test-connector'))
|
|
27
|
+
.toBe('/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('display url to store url', async () => {
|
|
31
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
32
|
+
// Convert a valid URL as displayed
|
|
33
|
+
expect(displayedToStored('/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector'))
|
|
34
|
+
.toBe('/assets/test.webp')
|
|
35
|
+
// Convert a URL which is already as stored
|
|
36
|
+
expect(displayedToStored('/assets/test.webp'))
|
|
37
|
+
.toBe('/assets/test.webp')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('store url to display url with a root path', async () => {
|
|
41
|
+
Object.assign(window.location, {
|
|
42
|
+
href: 'http://localhost:6800/silex',
|
|
43
|
+
pathname: '/silex',
|
|
44
|
+
origin: 'http://localhost:6800',
|
|
45
|
+
})
|
|
46
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
47
|
+
// Convert a valid URL as stored
|
|
48
|
+
expect(storedToDisplayed('/assets/test.webp', 'test-id', 'test-connector'))
|
|
49
|
+
.toBe('/silex/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
50
|
+
// Convert a URL which is already as displayed
|
|
51
|
+
expect(storedToDisplayed('/silex/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector', 'test-id', 'test-connector'))
|
|
52
|
+
.toBe('/silex/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
it('display url to store url with a root path', async () => {
|
|
56
|
+
Object.assign(window.location, {
|
|
57
|
+
href: 'http://localhost:6800/silex',
|
|
58
|
+
pathname: '/silex',
|
|
59
|
+
origin: 'http://localhost:6800',
|
|
60
|
+
})
|
|
61
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
62
|
+
// Convert a valid URL as displayed
|
|
63
|
+
expect(displayedToStored('/silex/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector'))
|
|
64
|
+
.toBe('/assets/test.webp')
|
|
65
|
+
// Convert a URL which is already as stored
|
|
66
|
+
expect(displayedToStored('/assets/test.webp'))
|
|
67
|
+
.toBe('/assets/test.webp')
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('store url to display url with escapable chars', async () => {
|
|
71
|
+
Object.assign(window.location, {
|
|
72
|
+
href: 'http://localhost:6800/silex%20with%20spaces',
|
|
73
|
+
pathname: '/silex%20with%20spaces',
|
|
74
|
+
origin: 'http://localhost:6800',
|
|
75
|
+
})
|
|
76
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
77
|
+
// Convert a valid URL as displayed
|
|
78
|
+
expect(displayedToStored('/silex%20with%20spaces/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector'))
|
|
79
|
+
.toBe('/assets/test.webp')
|
|
80
|
+
// Convert a URL which is already as stored
|
|
81
|
+
expect(displayedToStored('/assets/test.webp'))
|
|
82
|
+
.toBe('/assets/test.webp')
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('display url to store url with escapable chars', async () => {
|
|
86
|
+
Object.assign(window.location, {
|
|
87
|
+
href: 'http://localhost:6800/silex%20with%20spaces',
|
|
88
|
+
pathname: '/silex%20with%20spaces',
|
|
89
|
+
origin: 'http://localhost:6800',
|
|
90
|
+
})
|
|
91
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
92
|
+
// Convert a valid URL as stored
|
|
93
|
+
expect(storedToDisplayed('/assets/test.webp', 'test-id', 'test-connector'))
|
|
94
|
+
.toBe('/silex with spaces/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
95
|
+
// Convert a URL which is already as displayed
|
|
96
|
+
expect(storedToDisplayed('/silex%20with%20spaces/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector', 'test-id', 'test-connector'))
|
|
97
|
+
.toBe('/silex%20with%20spaces/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
98
|
+
expect(storedToDisplayed('/silex with spaces/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector', 'test-id', 'test-connector'))
|
|
99
|
+
.toBe('/silex with spaces/api/website/assets/test.webp?websiteId=test-id&connectorId=test-connector')
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('store url to display url with escapable website id and connector id', async () => {
|
|
103
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
104
|
+
// Convert a valid URL as displayed
|
|
105
|
+
expect(displayedToStored('/api/website/assets/test.webp?websiteId=test%20id&connectorId=test%20connector'))
|
|
106
|
+
.toBe('/assets/test.webp')
|
|
107
|
+
// Convert a URL which is already as stored
|
|
108
|
+
expect(displayedToStored('/assets/test.webp'))
|
|
109
|
+
.toBe('/assets/test.webp')
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
it('display url to store url with escapable website id and connector id', async () => {
|
|
113
|
+
const { displayedToStored, storedToDisplayed } = await import('./assetUrl')
|
|
114
|
+
const websiteId = 'test id'
|
|
115
|
+
const websiteIdEncoded = 'test+id'
|
|
116
|
+
const connectorId = 'test connector'
|
|
117
|
+
const connectorIdEncoded = 'test+connector'
|
|
118
|
+
// Convert a valid URL as stored
|
|
119
|
+
expect(storedToDisplayed('/assets/test.webp', websiteId, connectorId))
|
|
120
|
+
.toBe(`/api/website/assets/test.webp?websiteId=${websiteIdEncoded}&connectorId=${connectorIdEncoded}`)
|
|
121
|
+
// Convert a URL which is already as displayed
|
|
122
|
+
expect(storedToDisplayed(`/api/website/assets/test.webp?websiteId=${websiteIdEncoded}&connectorId=${connectorIdEncoded}`, websiteId, connectorId))
|
|
123
|
+
.toBe(`/api/website/assets/test.webp?websiteId=${websiteIdEncoded}&connectorId=${connectorIdEncoded}`)
|
|
124
|
+
})
|
|
125
|
+
})
|