-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1454 from Lumieducation/master
Release next version
- Loading branch information
Showing
106 changed files
with
15,438 additions
and
4,698 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
[package.json] | ||
# Change these settings to your own preference | ||
indent_style = space | ||
indent_size = 4 | ||
|
||
# We recommend you to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,3 +26,7 @@ microsoft.gpg | |
# Dependency directory | ||
node_modules | ||
/h5p | ||
|
||
h5p_libs | ||
google_translate.json | ||
.json-autotranslate-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ import store from '../state'; | |
import { track } from '../state/track/actions'; | ||
|
||
Sentry.init({ | ||
dsn: 'http://[email protected]/3', | ||
dsn: 'https://[email protected]/3', | ||
release: process.env.VERSION, | ||
environment: process.env.NODE_ENV, | ||
beforeSend: (event: Sentry.Event, hint: Sentry.EventHint) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
import type { | ||
IInstalledLibrary, | ||
ILibraryAdministrationOverviewItem | ||
} from '@lumieducation/h5p-server'; | ||
|
||
/** | ||
* The data model used to display the library list. | ||
*/ | ||
export interface ILibraryViewModel extends ILibraryAdministrationOverviewItem { | ||
details?: IInstalledLibrary & { | ||
dependentsCount: number; | ||
instancesAsDependencyCount: number; | ||
instancesCount: number; | ||
isAddon: boolean; | ||
}; | ||
isDeleting?: boolean; | ||
isShowingDetails?: boolean; | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
export class LibraryAdministrationService { | ||
constructor(private baseUrl: string) {} | ||
|
||
public async deleteLibrary(library: ILibraryViewModel): Promise<void> { | ||
const response = await fetch( | ||
`${this.baseUrl}/${library.machineName}-${library.majorVersion}.${library.minorVersion}`, | ||
{ | ||
method: 'DELETE' | ||
} | ||
); | ||
|
||
if (response.ok) { | ||
return; | ||
} | ||
throw new Error( | ||
`Could not delete library: ${response.status} - ${response.text}` | ||
); | ||
} | ||
|
||
public async getLibraries(): Promise<ILibraryViewModel[]> { | ||
const response = await fetch(this.baseUrl); | ||
if (response.ok) { | ||
return response.json(); | ||
} | ||
throw new Error( | ||
`Could not get library list: ${response.status} - ${response.statusText}` | ||
); | ||
} | ||
|
||
public async getLibrary( | ||
library: ILibraryViewModel | ||
): Promise< | ||
IInstalledLibrary & { | ||
dependentsCount: number; | ||
instancesAsDependencyCount: number; | ||
instancesCount: number; | ||
isAddon: boolean; | ||
} | ||
> { | ||
const response = await fetch( | ||
`${this.baseUrl}/${library.machineName}-${library.majorVersion}.${library.minorVersion}` | ||
); | ||
if (response.ok) { | ||
return response.json(); | ||
} | ||
throw new Error( | ||
`Could not get library details: ${response.status} - ${response.statusText}` | ||
); | ||
} | ||
|
||
public async patchLibrary( | ||
library: ILibraryViewModel, | ||
changes: Partial<ILibraryViewModel> | ||
): Promise<ILibraryViewModel> { | ||
const response = await fetch( | ||
`${this.baseUrl}/${library.machineName}-${library.majorVersion}.${library.minorVersion}`, | ||
{ | ||
method: 'PATCH', | ||
headers: { | ||
'Content-Type': 'application/json;charset=UTF-8' | ||
}, | ||
body: JSON.stringify(changes) | ||
} | ||
); | ||
if (response.ok) { | ||
return { ...library, ...changes }; | ||
} | ||
throw new Error( | ||
`Could not patch library: ${response.status} - ${response.statusText}` | ||
); | ||
} | ||
|
||
public async postPackage( | ||
file: File | ||
): Promise<{ installed: number; updated: number }> { | ||
const formData = new FormData(); | ||
formData.append('file', file); | ||
|
||
const response = await fetch(this.baseUrl, { | ||
method: 'POST', | ||
body: formData | ||
}); | ||
if (response.ok) { | ||
const result = await response.json(); | ||
return { installed: result.installed, updated: result.updated }; | ||
} | ||
throw new Error( | ||
`Could not upload package with libraries: ${response.status} - ${response.statusText}` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import superagent from 'superagent'; | ||
|
||
import { IFile } from './AnalyticsTypes'; | ||
|
||
export async function importAnalytics(): Promise<{ | ||
users: any[]; | ||
interactions: any[]; | ||
files: IFile[]; | ||
}> { | ||
const response = await superagent.get('/api/v1/analytics'); | ||
|
||
return { | ||
users: response.body.users, | ||
interactions: response.body.interactions | ||
files: response.body | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.