@silexlabs/silex 3.0.0-alpha.49 → 3.0.0-alpha.51
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/dist/client/client/config.d.ts +14 -1
- package/dist/client/client/grapesjs/PublicationManager.d.ts +2 -7
- package/dist/client/client/publication-transformers.d.ts +41 -0
- package/dist/client/css/admin.css +4 -1
- package/dist/client/js/main.js +3 -3
- package/dist/client/types.d.ts +18 -16
- package/dist/plugins/client/client/api.d.ts +83 -0
- package/dist/plugins/client/client/api.js +105 -0
- package/dist/plugins/client/client/api.js.map +1 -0
- package/dist/plugins/client/client/config.d.ts +58 -0
- package/dist/plugins/client/client/config.js +80 -0
- package/dist/plugins/client/client/config.js.map +1 -0
- package/dist/plugins/client/client/events.js +2 -0
- package/dist/plugins/client/client/events.js.map +1 -1
- package/dist/plugins/client/client/grapesjs/LoginDialog.d.ts +15 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.js +193 -0
- package/dist/plugins/client/client/grapesjs/LoginDialog.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.d.ts +70 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.js +310 -0
- package/dist/plugins/client/client/grapesjs/PublicationManager.js.map +1 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.d.ts +61 -0
- package/dist/plugins/client/client/grapesjs/PublicationUi.js +324 -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/index.d.ts +5 -0
- package/dist/plugins/client/client/grapesjs/index.js +264 -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 +220 -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 +106 -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 +197 -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 +124 -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 +165 -0
- package/dist/plugins/client/client/publication-transformers.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/plugins/client/11ty.d.ts +17 -0
- package/dist/plugins/client/plugins/client/11ty.js +70 -0
- package/dist/plugins/client/plugins/client/11ty.js.map +1 -0
- package/dist/plugins/client/plugins/client/publicationRenderer.js +59 -21
- package/dist/plugins/client/plugins/client/publicationRenderer.js.map +1 -1
- package/dist/plugins/client/plugins/client/website-info.js +1 -1
- package/dist/plugins/client/plugins/client/website-info.js.map +1 -1
- package/dist/plugins/client/types.d.ts +18 -16
- package/dist/plugins/client/types.js.map +1 -1
- package/dist/plugins/server/plugins/server/FtpConnector.d.ts +2 -1
- package/dist/plugins/server/plugins/server/FtpConnector.js +5 -6
- package/dist/plugins/server/plugins/server/FtpConnector.js.map +1 -1
- package/dist/plugins/server/plugins/server/GitlabConnector.d.ts +1 -7
- package/dist/plugins/server/plugins/server/GitlabConnector.js +124 -112
- package/dist/plugins/server/plugins/server/GitlabConnector.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsHosting.d.ts +2 -1
- package/dist/plugins/server/server/connectors/FsHosting.js +4 -5
- package/dist/plugins/server/server/connectors/FsHosting.js.map +1 -1
- package/dist/plugins/server/server/connectors/FsStorage.js +1 -0
- package/dist/plugins/server/server/connectors/FsStorage.js.map +1 -1
- package/dist/plugins/server/server/connectors/connectors.d.ts +2 -1
- package/dist/plugins/server/server/connectors/connectors.js.map +1 -1
- package/dist/plugins/server/server/jobs.d.ts +6 -0
- package/dist/plugins/server/server/jobs.js +3 -1
- package/dist/plugins/server/server/jobs.js.map +1 -1
- package/dist/plugins/server/types.d.ts +18 -16
- package/dist/plugins/server/types.js.map +1 -1
- package/dist/server/server/api/publicationApi.js +14 -20
- package/dist/server/server/connectors/FsHosting.js +4 -5
- package/dist/server/server/connectors/FsStorage.js +1 -0
- package/dist/server/server/jobs.js +2 -1
- package/package.json +1 -1
- package/public/silex.js +23 -0
- package/src/css/website-info.scss +4 -1
- package/src/ts/client/config.ts +22 -2
- package/src/ts/client/events.ts +3 -0
- package/src/ts/client/grapesjs/PublicationManager.ts +23 -3
- package/src/ts/client/grapesjs/internal-links.ts +0 -2
- package/src/ts/client/grapesjs/storage.ts +1 -1
- package/src/ts/client/index.ts +4 -0
- package/src/ts/client/publication-transformers.test.ts +146 -0
- package/src/ts/client/publication-transformers.ts +188 -0
- package/src/ts/plugins/client/11ty.ts +89 -0
- package/src/ts/plugins/client/publicationRenderer.ts +64 -22
- package/src/ts/plugins/client/website-info.ts +1 -1
- package/src/ts/plugins/server/FtpConnector.ts +3 -3
- package/src/ts/plugins/server/GitlabConnector.ts +128 -109
- package/src/ts/server/api/publicationApi.ts +16 -23
- package/src/ts/server/connectors/FsHosting.ts +2 -2
- package/src/ts/server/connectors/FsStorage.ts +1 -0
- package/src/ts/server/connectors/connectors.ts +3 -1
- package/src/ts/server/jobs.ts +10 -0
- package/src/ts/server/utils/BackwardCompat.ts +530 -529
- package/src/ts/types.ts +20 -17
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
import { ClientEvent } from './events';
|
|
18
|
+
import { onAll } from './utils';
|
|
19
|
+
/**
|
|
20
|
+
* @fileoverview Silex publication transformers are used to control how the site is rendered and published
|
|
21
|
+
*/
|
|
22
|
+
// Properties names used to store the original methods on the components and styles
|
|
23
|
+
const ATTRIBUTE_METHOD_STORE_HTML = 'tmp-pre-publication-transformer-tohtml';
|
|
24
|
+
const ATTRIBUTE_METHOD_STORE_CSS = 'tmp-pre-publication-transformer-tocss';
|
|
25
|
+
/**
|
|
26
|
+
* Init publication transformers
|
|
27
|
+
* Called at startup in the /index.ts file
|
|
28
|
+
*/
|
|
29
|
+
export async function initPublicationTransformers(config) {
|
|
30
|
+
const editor = config.getEditor();
|
|
31
|
+
// Override default rendering of components and styles
|
|
32
|
+
// Also create page slugs
|
|
33
|
+
editor.on(ClientEvent.PUBLISH_START, () => {
|
|
34
|
+
transformComponents(config);
|
|
35
|
+
transformStyles(config);
|
|
36
|
+
transformPages(config);
|
|
37
|
+
});
|
|
38
|
+
// Reset the components and styles rendering
|
|
39
|
+
editor.on(ClientEvent.PUBLISH_END, () => {
|
|
40
|
+
resetTransformComponents(config);
|
|
41
|
+
resetTransformStyles(config);
|
|
42
|
+
resetTransformPages(config);
|
|
43
|
+
});
|
|
44
|
+
// Transform files after generating all files to be published
|
|
45
|
+
editor.on(ClientEvent.PUBLISH_DATA, (data) => {
|
|
46
|
+
transformFiles(config, data);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Alter the components rendering
|
|
51
|
+
* Exported for unit tests
|
|
52
|
+
*/
|
|
53
|
+
export function transformComponents(config) {
|
|
54
|
+
const editor = config.getEditor();
|
|
55
|
+
onAll(editor, (c) => {
|
|
56
|
+
if (c.get(ATTRIBUTE_METHOD_STORE_HTML)) {
|
|
57
|
+
console.warn('Publication transformer: HTML transform already altered', c);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
const initialToHTML = c.toHTML.bind(c);
|
|
61
|
+
c[ATTRIBUTE_METHOD_STORE_HTML] = c.toHTML;
|
|
62
|
+
c.toHTML = () => {
|
|
63
|
+
return config.publicationTransformers.reduce((html, transformer) => {
|
|
64
|
+
try {
|
|
65
|
+
return transformer.renderComponent ? transformer.renderComponent(c, initialToHTML) ?? html : html;
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
console.error('Publication transformer: error rendering component', c, e);
|
|
69
|
+
return html;
|
|
70
|
+
}
|
|
71
|
+
}, initialToHTML());
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Alter the styles rendering
|
|
78
|
+
* Exported for unit tests
|
|
79
|
+
*/
|
|
80
|
+
export function transformStyles(config) {
|
|
81
|
+
const editor = config.getEditor();
|
|
82
|
+
editor.Css.getAll().forEach(c => {
|
|
83
|
+
if (c[ATTRIBUTE_METHOD_STORE_CSS]) {
|
|
84
|
+
console.warn('Publication transformer: CSS transform already altered', c);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const initialGetStyle = c.getStyle.bind(c);
|
|
88
|
+
c[ATTRIBUTE_METHOD_STORE_CSS] = c.getStyle;
|
|
89
|
+
c.getStyle = () => {
|
|
90
|
+
try {
|
|
91
|
+
return config.publicationTransformers.reduce((style, transformer) => {
|
|
92
|
+
return {
|
|
93
|
+
...transformer.renderCssRule ? transformer.renderCssRule(c, initialGetStyle) ?? style : style,
|
|
94
|
+
};
|
|
95
|
+
}, initialGetStyle());
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
console.error('Publication transformer: error rendering style', c, e);
|
|
99
|
+
return initialGetStyle();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create page slugs
|
|
107
|
+
* Exported for unit tests
|
|
108
|
+
*/
|
|
109
|
+
export function transformPages(config) {
|
|
110
|
+
const editor = config.getEditor();
|
|
111
|
+
editor.Pages.getAll().forEach((page) => {
|
|
112
|
+
page.set('slug', config.publicationTransformers.reduce((slug, transformer) => {
|
|
113
|
+
try {
|
|
114
|
+
return transformer.pageToSlug ? transformer.pageToSlug(page) ?? slug : slug;
|
|
115
|
+
}
|
|
116
|
+
catch (e) {
|
|
117
|
+
console.error('Publication transformer: error creating page slug', page, e);
|
|
118
|
+
return slug;
|
|
119
|
+
}
|
|
120
|
+
}, page.get('slug')));
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Transform files
|
|
125
|
+
* Exported for unit tests
|
|
126
|
+
*/
|
|
127
|
+
export function transformFiles(config, data) {
|
|
128
|
+
data.files = config.publicationTransformers.reduce((files, transformer) => {
|
|
129
|
+
return files.map((file, idx) => {
|
|
130
|
+
try {
|
|
131
|
+
const page = data.pages[idx] ?? null;
|
|
132
|
+
return transformer.transformFile ? transformer.transformFile(file, page) ?? file : file;
|
|
133
|
+
}
|
|
134
|
+
catch (e) {
|
|
135
|
+
console.error('Publication transformer: error transforming file', file, e);
|
|
136
|
+
return file;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}, data.files);
|
|
140
|
+
}
|
|
141
|
+
export function resetTransformComponents(config) {
|
|
142
|
+
const editor = config.getEditor();
|
|
143
|
+
onAll(editor, (c) => {
|
|
144
|
+
if (c[ATTRIBUTE_METHOD_STORE_HTML]) {
|
|
145
|
+
c.toHTML = c[ATTRIBUTE_METHOD_STORE_HTML];
|
|
146
|
+
delete c[ATTRIBUTE_METHOD_STORE_HTML];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
export function resetTransformStyles(config) {
|
|
151
|
+
const editor = config.getEditor();
|
|
152
|
+
editor.Css.getAll().forEach(c => {
|
|
153
|
+
if (c[ATTRIBUTE_METHOD_STORE_CSS]) {
|
|
154
|
+
c.getStyle = c[ATTRIBUTE_METHOD_STORE_CSS];
|
|
155
|
+
delete c[ATTRIBUTE_METHOD_STORE_CSS];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export function resetTransformPages(config) {
|
|
160
|
+
const editor = config.getEditor();
|
|
161
|
+
editor.Pages.getAll().forEach(page => {
|
|
162
|
+
page.unset('slug');
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=publication-transformers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publication-transformers.js","sourceRoot":"","sources":["../../../../src/ts/client/publication-transformers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAE/B;;GAEG;AAEH,mFAAmF;AACnF,MAAM,2BAA2B,GAAG,wCAAwC,CAAA;AAC5E,MAAM,0BAA0B,GAAG,uCAAuC,CAAA;AAkB1E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,MAAoB;IACpE,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IACjC,sDAAsD;IACtD,yBAAyB;IACzB,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,aAAa,EAAE,GAAG,EAAE;QACxC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC3B,eAAe,CAAC,MAAM,CAAC,CAAA;QACvB,cAAc,CAAC,MAAM,CAAC,CAAA;IACxB,CAAC,CAAC,CAAA;IACF,4CAA4C;IAC5C,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,GAAG,EAAE;QACtC,wBAAwB,CAAC,MAAM,CAAC,CAAA;QAChC,oBAAoB,CAAC,MAAM,CAAC,CAAA;QAC5B,mBAAmB,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IACF,6DAA6D;IAC7D,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,YAAY,EAAE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CAAA;YACzC,OAAO,CAAC,CAAC,2BAA2B,CAAC,CAAA;SACtC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,MAAoB;IACvD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IACjC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;QAC9B,IAAI,CAAC,CAAC,0BAA0B,CAAC,EAAE;YACjC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,0BAA0B,CAAC,CAAA;YAC1C,OAAO,CAAC,CAAC,0BAA0B,CAAC,CAAA;SACrC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,MAAoB;IACtD,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,EAAE,CAAA;IACjC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACnC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACpB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview define constants for Silex client and server
|
|
3
|
+
*/
|
|
4
|
+
export declare const WEBSITE_DATA_FILE = "website.json";
|
|
5
|
+
export declare const WEBSITE_META_DATA_FILE = "meta.json";
|
|
6
|
+
export declare const DEFAULT_WEBSITE_ID = "default";
|
|
7
|
+
export declare const DEFAULT_LANGUAGE = "en";
|
|
8
|
+
export declare const CLIENT_CONFIG_FILE_NAME = "silex.js";
|
|
9
|
+
export declare const API_PATH = "/api";
|
|
10
|
+
export declare const API_CONNECTOR_PATH = "/connector";
|
|
11
|
+
export declare const API_CONNECTOR_USER = "/user";
|
|
12
|
+
export declare const API_CONNECTOR_LIST = "/";
|
|
13
|
+
export declare const API_CONNECTOR_LOGOUT = "/logout";
|
|
14
|
+
export declare const API_CONNECTOR_LOGIN = "/login";
|
|
15
|
+
export declare const API_CONNECTOR_SETTINGS = "/settings";
|
|
16
|
+
export declare const API_CONNECTOR_LOGIN_CALLBACK = "/login/callback";
|
|
17
|
+
export declare const API_PUBLICATION_PATH = "/publication";
|
|
18
|
+
export declare const API_PUBLICATION_PUBLISH = "/";
|
|
19
|
+
export declare const API_PUBLICATION_STATUS = "/publication/status";
|
|
20
|
+
export declare const API_WEBSITE_PATH = "/website";
|
|
21
|
+
export declare const API_WEBSITE_READ = "/";
|
|
22
|
+
export declare const API_WEBSITE_WRITE = "/";
|
|
23
|
+
export declare const API_WEBSITE_CREATE = "/";
|
|
24
|
+
export declare const API_WEBSITE_DELETE = "/";
|
|
25
|
+
export declare const API_WEBSITE_LIST = "/";
|
|
26
|
+
export declare const API_WEBSITE_ASSET_READ = "/assets";
|
|
27
|
+
export declare const API_WEBSITE_ASSETS_WRITE = "/assets";
|
|
28
|
+
export declare const API_WEBSITE_META_READ = "/meta";
|
|
29
|
+
export declare const API_WEBSITE_META_WRITE = "/meta";
|
|
@@ -0,0 +1,46 @@
|
|
|
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
|
+
* @fileoverview define constants for Silex client and server
|
|
19
|
+
*/
|
|
20
|
+
export const WEBSITE_DATA_FILE = 'website.json';
|
|
21
|
+
export const WEBSITE_META_DATA_FILE = 'meta.json';
|
|
22
|
+
export const DEFAULT_WEBSITE_ID = 'default';
|
|
23
|
+
export const DEFAULT_LANGUAGE = 'en';
|
|
24
|
+
export const CLIENT_CONFIG_FILE_NAME = 'silex.js';
|
|
25
|
+
export const API_PATH = '/api';
|
|
26
|
+
export const API_CONNECTOR_PATH = '/connector';
|
|
27
|
+
export const API_CONNECTOR_USER = '/user';
|
|
28
|
+
export const API_CONNECTOR_LIST = '/';
|
|
29
|
+
export const API_CONNECTOR_LOGOUT = '/logout';
|
|
30
|
+
export const API_CONNECTOR_LOGIN = '/login';
|
|
31
|
+
export const API_CONNECTOR_SETTINGS = '/settings';
|
|
32
|
+
export const API_CONNECTOR_LOGIN_CALLBACK = '/login/callback';
|
|
33
|
+
export const API_PUBLICATION_PATH = '/publication';
|
|
34
|
+
export const API_PUBLICATION_PUBLISH = '/';
|
|
35
|
+
export const API_PUBLICATION_STATUS = '/publication/status';
|
|
36
|
+
export const API_WEBSITE_PATH = '/website';
|
|
37
|
+
export const API_WEBSITE_READ = '/';
|
|
38
|
+
export const API_WEBSITE_WRITE = '/';
|
|
39
|
+
export const API_WEBSITE_CREATE = '/';
|
|
40
|
+
export const API_WEBSITE_DELETE = '/';
|
|
41
|
+
export const API_WEBSITE_LIST = '/';
|
|
42
|
+
export const API_WEBSITE_ASSET_READ = '/assets';
|
|
43
|
+
export const API_WEBSITE_ASSETS_WRITE = '/assets';
|
|
44
|
+
export const API_WEBSITE_META_READ = '/meta';
|
|
45
|
+
export const API_WEBSITE_META_WRITE = '/meta';
|
|
46
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/ts/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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wB,GAAG,SAAS,CAAA;AACjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ClientConfig } from '../../client/config';
|
|
2
|
+
interface PluginOptions {
|
|
3
|
+
html: {
|
|
4
|
+
url: string;
|
|
5
|
+
path: string;
|
|
6
|
+
};
|
|
7
|
+
css: {
|
|
8
|
+
url: string;
|
|
9
|
+
path: string;
|
|
10
|
+
};
|
|
11
|
+
assets: {
|
|
12
|
+
url: string;
|
|
13
|
+
path: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
declare const _default: (config: ClientConfig, opts: Partial<PluginOptions>) => void;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export default (config, opts) => {
|
|
2
|
+
const options = {
|
|
3
|
+
...opts,
|
|
4
|
+
html: {
|
|
5
|
+
url: '/',
|
|
6
|
+
path: './',
|
|
7
|
+
...opts.html,
|
|
8
|
+
},
|
|
9
|
+
css: {
|
|
10
|
+
url: '/css',
|
|
11
|
+
path: './css',
|
|
12
|
+
...opts.css,
|
|
13
|
+
},
|
|
14
|
+
assets: {
|
|
15
|
+
url: '/assets',
|
|
16
|
+
path: './',
|
|
17
|
+
...opts.assets,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
config.addPublicationTransformers({
|
|
21
|
+
transformFile: (file, page) => {
|
|
22
|
+
const fileWithContent = file;
|
|
23
|
+
console.log('Silex: transform file for 11ty', fileWithContent);
|
|
24
|
+
switch (file.type) {
|
|
25
|
+
case 'html':
|
|
26
|
+
return {
|
|
27
|
+
...file,
|
|
28
|
+
path: options.html.path + fileWithContent.path,
|
|
29
|
+
//content: `---\npermalink: ${options.html.url}${fileWithContent.path}\n---\n${fileWithContent.content}`
|
|
30
|
+
};
|
|
31
|
+
case 'css':
|
|
32
|
+
return {
|
|
33
|
+
...file,
|
|
34
|
+
path: options.css.path + fileWithContent.path.replace(/\.css$/, '.css.liquid'),
|
|
35
|
+
content: `---\npermalink: ${options.css.url}${fileWithContent.path}\n---\n${fileWithContent.content}`
|
|
36
|
+
};
|
|
37
|
+
case 'asset':
|
|
38
|
+
return {
|
|
39
|
+
...file,
|
|
40
|
+
path: options.assets.path + fileWithContent.path,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
throw new Error(`Unknown file type ${file.type}`);
|
|
44
|
+
},
|
|
45
|
+
renderComponent: (c, toHtml) => {
|
|
46
|
+
if (c.get('type') === 'image') {
|
|
47
|
+
// Concat the paths, handles the trailing and leading slashes
|
|
48
|
+
const publishedUrl = path => `${options.assets.url.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
49
|
+
const src = c.get('src');
|
|
50
|
+
c.set('src', publishedUrl(src));
|
|
51
|
+
const html = toHtml();
|
|
52
|
+
console.log('Silex: transform component for 11ty', publishedUrl, html);
|
|
53
|
+
c.set('src', src);
|
|
54
|
+
return html;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
renderCssRule(c, getStyle) {
|
|
58
|
+
const publishedUrl = path => `${options.assets.url.replace(/\/+$/, '')}/${path.replace(/^\/+/, '')}`;
|
|
59
|
+
const url = getStyle()['background-image'];
|
|
60
|
+
const bgUrl = url?.match(/url\('(.*)'\)/)?.pop();
|
|
61
|
+
if (bgUrl) {
|
|
62
|
+
return {
|
|
63
|
+
...getStyle(),
|
|
64
|
+
'background-image': `url('${publishedUrl(bgUrl)}')`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=11ty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"11ty.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/11ty.ts"],"names":[],"mappings":"AAmBA,eAAe,CAAC,MAAoB,EAAE,IAA4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;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,3 +1,39 @@
|
|
|
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
|
+
// Silex: publication renderer plugin is deprecated. Use the publication renderer plugin instead.
|
|
18
|
+
console.warn('Silex: publication renderer plugin is deprecated. Use the publication renderer plugin instead.');
|
|
19
|
+
/* Usage:
|
|
20
|
+
import publicationRenderer from '/node_modules/@silexlabs/silex/dist/plugins/client/plugins/client/publicationRenderer.js'
|
|
21
|
+
await config.addPlugin(publicationRenderer, {
|
|
22
|
+
css: {
|
|
23
|
+
frontMatter: true,
|
|
24
|
+
ext: '.css.liquid',
|
|
25
|
+
path: '../../../pages'
|
|
26
|
+
},
|
|
27
|
+
html: {
|
|
28
|
+
frontMatter: false,
|
|
29
|
+
path: '../../../_includes'
|
|
30
|
+
},
|
|
31
|
+
assets: {
|
|
32
|
+
path: '../../../',
|
|
33
|
+
url: '/',
|
|
34
|
+
},
|
|
35
|
+
})
|
|
36
|
+
*/
|
|
1
37
|
import { getPageSlug } from '../../page.js';
|
|
2
38
|
import { onAll } from '../../client/utils.js';
|
|
3
39
|
import { ClientEvent } from '../../client/events.js';
|
|
@@ -102,27 +138,29 @@ export default (config, opts = {}) => {
|
|
|
102
138
|
});
|
|
103
139
|
}
|
|
104
140
|
});
|
|
105
|
-
editor.on(ClientEvent.PUBLISH_DATA, data => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
141
|
+
//editor.on(ClientEvent.PUBLISH_DATA, data => {
|
|
142
|
+
// data.pages.forEach((page: Page, idx) => {
|
|
143
|
+
// const file = data.files[idx] as ClientSideFile
|
|
144
|
+
// console.log('Silex: publication renderer: page', page, file)
|
|
145
|
+
// // CSS
|
|
146
|
+
// if(file.type === 'css') {
|
|
147
|
+
// file.cssPath = file.cssPath.replace(/\.css$/, options.css.ext)
|
|
148
|
+
// file.cssPath = options.css.path + file.cssPath
|
|
149
|
+
// if (options.css.frontMatter) {
|
|
150
|
+
// file.css = `---\npermalink: ${options.css.url}/${page.slug}.css\n---\n${file.css}`
|
|
151
|
+
// }
|
|
152
|
+
// // HTML
|
|
153
|
+
// file.htmlPath = file.htmlPath.replace(/\.html$/, options.html.ext)
|
|
154
|
+
// file.htmlPath = options.html.path + file.htmlPath
|
|
155
|
+
// if (options.html.frontMatter) {
|
|
156
|
+
// file.html = `---\npermalink: ${options.html.url}/${page.slug}.html\n---\n${file.html}`
|
|
157
|
+
// }
|
|
158
|
+
// })
|
|
159
|
+
// data.assets.forEach((asset, idx) => {
|
|
160
|
+
// asset.path = options.assets.path + asset.src
|
|
161
|
+
// // The rest is handled by the editor.Css.getAll loop
|
|
162
|
+
// })
|
|
163
|
+
//})
|
|
126
164
|
});
|
|
127
165
|
};
|
|
128
166
|
//# sourceMappingURL=publicationRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publicationRenderer.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/publicationRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"publicationRenderer.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/publicationRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iGAAiG;AACjG,OAAO,CAAC,IAAI,CAAC,gGAAgG,CAAC,CAAA;AAE9G;;;;;;;;;;;;;;;;;EAiBE;AAEF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAGpD,eAAe,CAAC,MAAM,EAAE,OAAY,EAAE,EAAE,EAAE;IACxC,MAAM,OAAO,GAAG;QACd,YAAY,EAAE,KAAK;QACnB,GAAG,IAAI;QACP,IAAI,EAAE;YACJ,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,IAAI;YACV,GAAG,IAAI,CAAC,IAAI;SACb;QACD,GAAG,EAAE;YACH,WAAW,EAAE,KAAK;YAClB,GAAG,EAAE,MAAM;YACX,GAAG,EAAE,MAAM;YACX,IAAI,EAAE,OAAO;YACb,GAAG,IAAI,CAAC,GAAG;SACZ;QACD,MAAM,EAAE;YACN,GAAG,EAAE,GAAG;YACR,IAAI,EAAE,IAAI;YACV,GAAG,IAAI,CAAC,MAAM;SACf;KACF,CAAA;IACD,MAAM,CAAC,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,EAAE,MAAM,E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AAG,CAAC,MAAM,EAAE;qBAChB,OAAO,CAAC,CAAC,CAAC,EAAE;oBACX,IAAI,CAAC,CAAC,GAAG,CAAC,gBAAuB,CAAC,EAAE;wBAClC,CAAC,CAAC,QAAQ,CAAC;4BACT,GAAG,CAAC,CAAC,QAAQ,EAAE;4BACf,kBAAkB,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAuB,CAAC,IAAI;yBAC/D,CAAC,CAAA;wBACF,CAAC,CAAC,GAAG,CAAC,gBAAuB,CAAC,CAAA;qBAC/B;gBACH,CAAC,CAAC,CAAA;aACL;QACH,CAAC,CAAC,CAAA;QACF,+CAA+C;QAC/C,6CAA6C;QAC7C,oDAAoD;QACpD,kEAAkE;QAClE,YAAY;QACZ,+BAA+B;QAC/B,oEAAoE;QACpE,oDAAoD;QACpD,oCAAoC;QACpC,0FAA0F;QAC1F,OAAO;QACP,aAAa;QACb,wEAAwE;QACxE,uDAAuD;QACvD,qCAAqC;QACrC,8FAA8F;QAC9F,OAAO;QACP,MAAM;QACN,yCAAyC;QACzC,kDAAkD;QAClD,0DAA0D;QAC1D,MAAM;QACN,IAAI;IACN,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -46,7 +46,7 @@ export default async function (config) {
|
|
|
46
46
|
topBar?.appendChild(container);
|
|
47
47
|
// Display the website meta data
|
|
48
48
|
container.innerHTML = `
|
|
49
|
-
|
|
49
|
+
${websiteMeta.imageUrl ? `<div class="gjs-website-meta-image" style="background: url(${websiteMeta.imageUrl});"></div>` : ''}
|
|
50
50
|
<div class="gjs-website-meta-name">${websiteMeta.name}</div>
|
|
51
51
|
`;
|
|
52
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website-info.js","sourceRoot":"","sources":["../../../../../src/ts/plugins/client/website-info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAQpD,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,8BAA8B;YAC9B,6CAA6C;YAC7C,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,mBAAmB,CAAC,CAAA;YAC1D,MAAM,EAAE,WAAW,CAAC,SAAS,CAAC,CAAA;YAC9B,gCAAgC;YAChC,SAAS,CAAC,SAAS,GAAG;UACjB,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,8DAA8D,WAAW,CAAC,QAAQ,YAAY,CAAC,CAAC,CAAC,EAAG;6CACzF,WAAW,CAAC,IAAI;OACtD,CAAA;QACH,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -5,7 +5,6 @@ export interface PublicationSettings {
|
|
|
5
5
|
connector?: ConnectorData;
|
|
6
6
|
options?: ConnectorOptions;
|
|
7
7
|
url?: string;
|
|
8
|
-
autoHomePage?: boolean;
|
|
9
8
|
}
|
|
10
9
|
export interface WebsiteFile {
|
|
11
10
|
html: string;
|
|
@@ -137,7 +136,7 @@ export type ApiConnectorUserQuery = {
|
|
|
137
136
|
export type ApiConnectorUserResponse = ConnectorUser;
|
|
138
137
|
export declare const defaultWebsiteData: WebsiteData;
|
|
139
138
|
export interface WebsiteData {
|
|
140
|
-
pages:
|
|
139
|
+
pages: any[];
|
|
141
140
|
assets: Asset[];
|
|
142
141
|
styles: Style[];
|
|
143
142
|
settings: WebsiteSettings;
|
|
@@ -146,7 +145,7 @@ export interface WebsiteData {
|
|
|
146
145
|
publication: PublicationSettings;
|
|
147
146
|
}
|
|
148
147
|
export interface PublicationData extends WebsiteData {
|
|
149
|
-
files?:
|
|
148
|
+
files?: ClientSideFile[];
|
|
150
149
|
}
|
|
151
150
|
export interface WebsiteSettings {
|
|
152
151
|
description?: string;
|
|
@@ -163,16 +162,6 @@ export interface Font {
|
|
|
163
162
|
value: string;
|
|
164
163
|
variants: string[];
|
|
165
164
|
}
|
|
166
|
-
export interface Page {
|
|
167
|
-
name?: string;
|
|
168
|
-
id: string;
|
|
169
|
-
type?: string;
|
|
170
|
-
frames: Frame[];
|
|
171
|
-
settings?: WebsiteSettings;
|
|
172
|
-
cssExt?: string;
|
|
173
|
-
htmlExt?: string;
|
|
174
|
-
slug?: string;
|
|
175
|
-
}
|
|
176
165
|
export interface Frame {
|
|
177
166
|
component: {
|
|
178
167
|
type: string;
|
|
@@ -216,13 +205,26 @@ export type Selector = string | {
|
|
|
216
205
|
export type ConnectorId = string;
|
|
217
206
|
export type ConnectorOptions = object;
|
|
218
207
|
/**
|
|
219
|
-
* Type for a client side file
|
|
220
|
-
* @see connector/File
|
|
208
|
+
* Type for a client side file when the content is available as a string
|
|
221
209
|
*/
|
|
222
|
-
export interface
|
|
210
|
+
export interface ClientSideFileWithContent {
|
|
223
211
|
path: string;
|
|
224
212
|
content: string;
|
|
213
|
+
type: 'html' | 'asset' | 'css';
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Type for a client side file when the content is in the storage connector
|
|
217
|
+
*/
|
|
218
|
+
export interface ClientSideFileWithSrc {
|
|
219
|
+
path: string;
|
|
220
|
+
src: string;
|
|
221
|
+
type: 'html' | 'asset' | 'css';
|
|
225
222
|
}
|
|
223
|
+
/**
|
|
224
|
+
* Type for a client side file
|
|
225
|
+
* @see connector/File
|
|
226
|
+
*/
|
|
227
|
+
export type ClientSideFile = ClientSideFileWithContent | ClientSideFileWithSrc;
|
|
226
228
|
/**
|
|
227
229
|
* Type for file listing
|
|
228
230
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAoBH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACY;IAA7C,YAAY,OAAe,EAAkB,cAAsB;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QAD6B,mBAAc,GAAd,cAAc,CAAQ;QAEjE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,CAAA;IACpD,CAAC;CACF;AA+CD,KAAK;AACL,cAAc;AACd,MAAM,CAAC,MAAM,kBAAkB,GAAgB;AAC7C,YAAY;AACZ,aAAa;AACb,aAAa;AACb,eAAe;AACf,YAAY;AACZ,cAAc;AACd,kBAAkB;CACJ,CAAA;AA8ChB,MAAM,CAAN,IAAY,IAEX;AAFD,WAAY,IAAI;IACd,iBAAS,CAAA;AACX,CAAC,EAFW,IAAI,KAAJ,IAAI,QAEf;AAmED;;GAEG;AACH,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,oCAAmB,CAAA;IACnB,oCAAmB,CAAA;AACrB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAuDD;;GAEG;AACH,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,wCAA2B,CAAA;IAC3B,gCAAmB,CAAA;IACnB,4BAAe,CAAA;AACjB,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB"}
|
|
@@ -3,6 +3,7 @@ import { Readable } from 'stream';
|
|
|
3
3
|
import { ConnectorFile, ConnectorFileContent, StatusCallback, StorageConnector } from '../../server/connectors/connectors';
|
|
4
4
|
import { ConnectorType, ConnectorUser, WebsiteMeta, JobData, WebsiteId, WebsiteMetaFileContent, WebsiteData, ConnectorOptions } from '../../types';
|
|
5
5
|
import { ServerConfig } from '../../server/config';
|
|
6
|
+
import { JobManager } from '../../server/jobs';
|
|
6
7
|
/**
|
|
7
8
|
* @fileoverview FTP connector for Silex
|
|
8
9
|
* This is a connector for Silex, which allows to store the website on a FTP server
|
|
@@ -79,5 +80,5 @@ export default class FtpConnector implements StorageConnector<FtpSession> {
|
|
|
79
80
|
readAsset(session: FtpSession, id: string, path: string): Promise<ConnectorFileContent>;
|
|
80
81
|
deleteAssets(session: FtpSession, id: WebsiteId, paths: string[]): Promise<void>;
|
|
81
82
|
getUrl(session: FtpSession, id: WebsiteId): Promise<string>;
|
|
82
|
-
publish(session: FtpSession, id:
|
|
83
|
+
publish(session: FtpSession, id: WebsiteId, files: ConnectorFile[], { startJob, jobSuccess, jobError }: JobManager): Promise<JobData>;
|
|
83
84
|
}
|
|
@@ -22,7 +22,6 @@ const connectors_1 = require("../../server/connectors/connectors");
|
|
|
22
22
|
const validation_1 = require("../../server/utils/validation");
|
|
23
23
|
const constants_1 = require("../../constants");
|
|
24
24
|
const types_1 = require("../../types");
|
|
25
|
-
const jobs_1 = require("../../server/jobs");
|
|
26
25
|
const path_1 = require("path");
|
|
27
26
|
const os_1 = require("os");
|
|
28
27
|
const uuid_1 = require("uuid");
|
|
@@ -309,7 +308,7 @@ class FtpConnector {
|
|
|
309
308
|
async getUser(session) {
|
|
310
309
|
return {
|
|
311
310
|
name: this.sessionData(session).user,
|
|
312
|
-
picture: 'data
|
|
311
|
+
picture: 'data:image/svg+xml,%3Csvg xmlns=\'http://www.w3.org/2000/svg\' height=\'1em\' viewBox=\'0 0 448 512\'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d=\'M224 256A128 128 0 1 0 224 0a128 128 0 1 0 0 256zm-45.7 48C79.8 304 0 383.8 0 482.3C0 498.7 13.3 512 29.7 512H418.3c16.4 0 29.7-13.3 29.7-29.7C448 383.8 368.2 304 269.7 304H178.3z\'/%3E%3C/svg%3E',
|
|
313
312
|
storage: await (0, connectors_1.toConnectorData)(session, this)
|
|
314
313
|
};
|
|
315
314
|
}
|
|
@@ -491,8 +490,8 @@ class FtpConnector {
|
|
|
491
490
|
console.warn('FIXME: do not store websiteUrl in the session, but in the website data');
|
|
492
491
|
return this.sessionData(session).websiteUrl ?? '';
|
|
493
492
|
}
|
|
494
|
-
async publish(session, id, files) {
|
|
495
|
-
const job =
|
|
493
|
+
async publish(session, id, files, { startJob, jobSuccess, jobError }) {
|
|
494
|
+
const job = startJob(`Publishing to ${this.displayName}`);
|
|
496
495
|
job.logs = [[`Publishing to ${this.displayName}`]];
|
|
497
496
|
job.errors = [[]];
|
|
498
497
|
// Create folders
|
|
@@ -507,11 +506,11 @@ class FtpConnector {
|
|
|
507
506
|
job.message = message;
|
|
508
507
|
job.logs[0].push(message);
|
|
509
508
|
if (status === types_1.JobStatus.SUCCESS) {
|
|
510
|
-
|
|
509
|
+
jobSuccess(job.jobId, message);
|
|
511
510
|
}
|
|
512
511
|
else if (status === types_1.JobStatus.ERROR) {
|
|
513
512
|
job.errors[0].push(message);
|
|
514
|
-
|
|
513
|
+
jobError(job.jobId, message);
|
|
515
514
|
}
|
|
516
515
|
});
|
|
517
516
|
return job;
|