Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: core 1.27.0 #3824

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/h5p-rest-example-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "npx tsc -P ./tsconfig.build.json",
"clean": "rm -rf h5p && rm -rf build && rm -rf coverage && rm -rf node_modules",
"prepare": "sh download-core.sh c79f97a16fd8c6fc0232c10d5bed5b94502ee9e9 c886fa6ded498bbe0148e9484f9b1534facc264e",
"prepare": "sh download-core.sh 829524eaf81fe3f3a295d0e843812be4735f51fc 80b3b281ee9d064b563f242e8ee7a0026b5bf205",
"start:watch": "npx ts-node-dev --deps --respawn src/index.ts",
"start": "npx ts-node -P ./tsconfig.build.json src/index.ts",
"start:shared-state:watch": "npx ts-node-dev --deps --respawn src/indexSharedState.ts",
Expand Down
11 changes: 9 additions & 2 deletions packages/h5p-server/assets/defaultClientStrings.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,12 @@
"emailAddressDescription": "client:emailAddressDescription",
"copyrightWarning": "client:copyrightWarning",
"keywordsExits": "client:keywordsExits",
"someKeywordsExits": "client:someKeywordsExits"
}
"someKeywordsExits": "client:someKeywordsExits",
"width": "client:width",
"height": "client:height",
"rotateLeft": "client:rotateLeft",
"rotateRight": "client:rotateRight",
"cropImage": "client:cropImage",
"confirmCrop": "client:confirmCrop",
"cancelCrop": "client:cancelCrop"
}
9 changes: 8 additions & 1 deletion packages/h5p-server/assets/translations/client/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,12 @@
"emailAddressDescription": "The email address will be used by H5P to reach out to the publisher in case of any issues with the content or in case the publisher needs to recover their account. It will not be published or shared with any third parties",
"copyrightWarning": "Copyrighted material cannot be shared in the H5P Content Hub. If the content is licensed with a OER friendly license like Creative Commons, please choose the appropriate license. If not this content cannot be shared.",
"keywordsExits": "Keywords already exists!",
"someKeywordsExits": "Some of these keywords already exist"
"someKeywordsExits": "Some of these keywords already exist",
"width": "width",
"height": "height",
"rotateLeft": "Rotate Left",
"rotateRight": "Rotate Right",
"cropImage": "Crop Image",
"confirmCrop": "Confirm Crop",
"cancelCrop": "Cancel Crop"
}
51 changes: 31 additions & 20 deletions packages/h5p-server/src/SemanticsEnforcer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,13 @@ export default class SemanticsEnforcer {
'td',
'th',
'colgroup',
'col',
'thead',
'tbody',
'tfoot',
'caption'
'caption',
'figure',
'figcaption'
];
}
if (allowedTags.includes('strong')) {
Expand Down Expand Up @@ -201,17 +204,17 @@ export default class SemanticsEnforcer {
allowedStyles['font-size'] = [/^[0-9.]+(em|px|%)$/i];
}
if (semantics.font.family) {
allowedStyles['font-family'] = [/^[-a-z0-9," ]+$/i];
allowedStyles['font-family'] = [/^[-a-z0-9,\'&; ]+$/i];
}
if (semantics.font.color) {
// eslint-disable-next-line @typescript-eslint/dot-notation
allowedStyles['color'] = [
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\))$/i
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)|hsla?\([0-9,.% ]+\)) *;?$/i
];
}
if (semantics.font.background) {
allowedStyles['background-color'] = [
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\))$/i
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)|hsla?\([0-9,.% ]+\)) *;?$/i
];
}
if (semantics.font.spacing) {
Expand All @@ -225,19 +228,27 @@ export default class SemanticsEnforcer {

const tableCellStyle = allowedTags.includes('table')
? {
'white-space': [/^(nowrap)|(normal)|(pre)$/i],
'text-align': [/^(center|left|right|justify)$/i],
'vertical-align': [
/^(baseline)|(text-top)|(text-bottom)|(sub)|(super)$/i
border: [
/^[0-9.]+(em|px|%|) *(none|solid|dotted|dashed|double|groove|ridge|inset|outset) *(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)|hsla?\([0-9,.% ]+\))$/i
],
height: [/^[0-9.]+(em|px|%)$/i],
'border-style': [
/^(none|solid|dotted|dashed|double|groove|ridge|inset|outset)$/i
],
'border-width': [/^[0-9.]+(em|px|%)$/i],
'border-color': [
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)|hsla?\([0-9,.% ]+\))$/i
],
'vertical-align': [/^(middle|top|bottom)$/i],
padding: [/^[0-9.]+(em|px|%|)$/i],
width: [/^[0-9.]+(em|px|%)$/i],
height: [/^[0-9.]+(em|px|%)$/i],
float: [/(right|left|none)/i],
'border-collapse': [/^collapse$/i],
'background-color': [
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\))$/i
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\)|hsla?\([0-9,.% ]+\))$/i
],
'border-color': [
/^(#[a-f0-9]{3}[a-f0-9]{3}?|rgba?\([0-9, ]+\))$/i
]
'white-space': [/^(nowrap)|(normal)|(pre)$/i],
'text-align': [/^(center|left|right|justify)$/i]
}
: undefined;

Expand All @@ -261,14 +272,14 @@ export default class SemanticsEnforcer {
},
allowedStyles: {
'*': allowedStyles,
table: allowedTags.includes('table')
? {
height: [/^[0-9.]+(em|px|%)$/i],
width: [/^[0-9.]+(em|px|%)$/i]
}
: undefined,
table: tableCellStyle,
td: tableCellStyle,
th: tableCellStyle
th: tableCellStyle,
colgroup: tableCellStyle,
col: tableCellStyle,
caption: tableCellStyle,
figure: tableCellStyle,
figcaption: tableCellStyle
}
});
}
Expand Down
6 changes: 3 additions & 3 deletions packages/h5p-server/src/editorAssetList.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"scripts/h5peditor-editor.js",
"scripts/h5peditor.js",
"language/en.js",
"scripts/h5p-hub-client.js",
"scripts/h5p-hub-client.js",
"scripts/h5peditor-semantic-structure.js",
"scripts/h5peditor-library-selector.js",
"scripts/h5peditor-fullscreen-bar.js",
Expand Down Expand Up @@ -64,11 +64,11 @@
"styles/h5p-core-button.css"
],
"editor": [
"libs/darkroom.css",
"libs/cropper.css",
"styles/css/h5p-hub-client.css",
"styles/css/fonts.css",
"styles/css/application.css",
"styles/css/libs/zebra_datepicker.min.css"
]
}
}
}
4 changes: 2 additions & 2 deletions packages/h5p-server/src/implementation/H5PConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class H5PConfig implements IH5PConfig {
'json png jpg jpeg gif bmp tif tiff svg eot ttf woff woff2 otf webm mp4 ogg mp3 m4a wav txt pdf rtf doc docx xls xlsx ppt pptx odt ods odp xml csv diff patch swf md textile vtt webvtt gltf glb';
public coreApiVersion: { major: number; minor: number } = {
major: 1,
minor: 26
minor: 27
};
public coreUrl: string = '/core';
public customization: {
Expand Down Expand Up @@ -69,7 +69,7 @@ export default class H5PConfig implements IH5PConfig {
public enableLrsContentTypes: boolean = true;
public exportMaxContentPathLength: number = 255;
public fetchingDisabled: 0 | 1 = 0;
public h5pVersion: string = '1.24-master';
public h5pVersion: string = '1.27.0';
public hubContentTypesEndpoint: string =
'https://api.h5p.org/v1/content-types/';
public hubRegistrationEndpoint: string = 'https://api.h5p.org/v1/sites';
Expand Down
9 changes: 6 additions & 3 deletions packages/h5p-server/src/playerAssetList.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
"js/h5p-content-type.js",
"js/h5p-confirmation-dialog.js",
"js/h5p-action-bar.js",
"js/request-queue.js"
"js/request-queue.js",
"js/h5p-tooltip.js"
]
},
"styles": {
"core": [
"styles/h5p.css",
"styles/h5p-confirmation-dialog.css",
"styles/h5p-core-button.css"
"styles/h5p-core-button.css",
"styles/h5p-tooltip.css",
"styles/h5p-table.css"
]
}
}
}
23 changes: 13 additions & 10 deletions packages/h5p-server/test/H5PPlayer.loadDependencies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ describe('Loading dependencies', () => {
metadataOverride: h5pObject as any
})
.then((model) => {
expect((model as any).styles.slice(3)).toEqual([
expect((model as any).styles.slice(5)).toEqual([
'/h5p/libraries/Foo-4.2/foo1.css?version=4.2.0',
'/h5p/libraries/Foo-4.2/foo2.css?version=4.2.0',
'/h5p/libraries/Bar-2.1/bar.css?version=2.1.0'
]);
expect((model as any).scripts.slice(9)).toEqual([
expect((model as any).scripts.slice(10)).toEqual([
'/h5p/libraries/Foo-4.2/foo1.js?version=4.2.0',
'/h5p/libraries/Foo-4.2/foo2.js?version=4.2.0',
'/h5p/libraries/Bar-2.1/bar.js?version=2.1.0'
Expand Down Expand Up @@ -148,12 +148,12 @@ describe('Loading dependencies', () => {
metadataOverride: h5pObject as any
})
.then((model) => {
expect((model as any).styles.slice(3)).toEqual([
expect((model as any).styles.slice(5)).toEqual([
'/h5p/libraries/Foo-4.2/foo1.css?version=4.2.0',
'/h5p/libraries/Foo-4.2/foo2.css?version=4.2.0',
'/h5p/libraries/Bar-2.1/bar.css?version=2.1.0'
]);
expect((model as any).scripts.slice(9)).toEqual([
expect((model as any).scripts.slice(10)).toEqual([
'/h5p/libraries/Foo-4.2/foo1.js?version=4.2.0',
'/h5p/libraries/Foo-4.2/foo2.js?version=4.2.0',
'/h5p/libraries/Bar-2.1/bar.js?version=2.1.0'
Expand Down Expand Up @@ -243,12 +243,12 @@ describe('Loading dependencies', () => {
metadataOverride: h5pObject as any
})
.then((model) => {
expect((model as any).styles.slice(3)).toEqual([
expect((model as any).styles.slice(5)).toEqual([
'/h5p/libraries/Baz-3.3/baz.css?version=3.3.0',
'/h5p/libraries/Bar-2.1/bar.css?version=2.1.0',
'/h5p/libraries/Foo-4.2/foo.css?version=4.2.0'
]);
expect((model as any).scripts.slice(9)).toEqual([
expect((model as any).scripts.slice(10)).toEqual([
'/h5p/libraries/Baz-3.3/baz.js?version=3.3.0',
'/h5p/libraries/Bar-2.1/bar.js?version=2.1.0',
'/h5p/libraries/Foo-4.2/foo.js?version=4.2.0'
Expand Down Expand Up @@ -331,12 +331,12 @@ describe('Loading dependencies', () => {
metadataOverride: h5pObject as any
})
.then((model) => {
expect((model as any).styles.slice(3)).toEqual([
expect((model as any).styles.slice(5)).toEqual([
'/h5p/libraries/Baz-3.3/baz.css?version=3.3.0',
'/h5p/libraries/Bar-2.1/bar.css?version=2.1.0',
'/h5p/libraries/Foo-4.2/foo.css?version=4.2.0'
]);
expect((model as any).scripts.slice(9)).toEqual([
expect((model as any).scripts.slice(10)).toEqual([
'/h5p/libraries/Baz-3.3/baz.js?version=3.3.0',
'/h5p/libraries/Bar-2.1/bar.js?version=2.1.0',
'/h5p/libraries/Foo-4.2/foo.js?version=4.2.0'
Expand Down Expand Up @@ -423,12 +423,12 @@ describe('Loading dependencies', () => {
metadataOverride: h5pObject as any
})
.then((model) => {
expect((model as any).styles.slice(3)).toEqual([
expect((model as any).styles.slice(5)).toEqual([
'/h5p/libraries/Baz-3.3/baz.css?version=3.3.0',
'/h5p/libraries/Bar-2.1/bar.css?version=2.1.0',
'/h5p/libraries/Foo-4.2/foo.css?version=4.2.0'
]);
expect((model as any).scripts.slice(9)).toEqual([
expect((model as any).scripts.slice(10)).toEqual([
'/h5p/libraries/Baz-3.3/baz.js?version=3.3.0',
'/h5p/libraries/Bar-2.1/bar.js?version=2.1.0',
'/h5p/libraries/Foo-4.2/foo.js?version=4.2.0'
Expand Down Expand Up @@ -523,6 +523,7 @@ describe('Loading dependencies', () => {
`/baseUrl/coreUrl/js/h5p-confirmation-dialog.js?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/js/h5p-action-bar.js?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/js/request-queue.js?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/js/h5p-tooltip.js?version=${config.h5pVersion}`,
`/baseUrl/libraryUrl/Baz-3.3/baz.js?version=3.3.0`,
`/baseUrl/libraryUrl/Bar-2.1/bar.js?version=2.1.0`,
`/baseUrl/libraryUrl/Foo-4.2/foo.js?version=4.2.0`
Expand All @@ -532,6 +533,8 @@ describe('Loading dependencies', () => {
`/baseUrl/coreUrl/styles/h5p.css?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/styles/h5p-confirmation-dialog.css?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/styles/h5p-core-button.css?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/styles/h5p-tooltip.css?version=${config.h5pVersion}`,
`/baseUrl/coreUrl/styles/h5p-table.css?version=${config.h5pVersion}`,
`/baseUrl/libraryUrl/Baz-3.3/baz.css?version=3.3.0`,
`/baseUrl/libraryUrl/Bar-2.1/bar.css?version=2.1.0`,
`/baseUrl/libraryUrl/Foo-4.2/foo.css?version=4.2.0`
Expand Down
Loading
Loading