From 0189b03fd2df5f3fcfd7debd63f3aa600511aec5 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 14 Oct 2024 15:59:07 +0200 Subject: [PATCH 1/5] Added static files from the SEZNAM license. --- src/static-files/cs/szn-dataset-license.html | 82 ++++++++++++++++++++ src/static-files/szn-dataset-license.html | 48 ++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 src/static-files/cs/szn-dataset-license.html create mode 100644 src/static-files/szn-dataset-license.html diff --git a/src/static-files/cs/szn-dataset-license.html b/src/static-files/cs/szn-dataset-license.html new file mode 100644 index 00000000000..eb4d04824f7 --- /dev/null +++ b/src/static-files/cs/szn-dataset-license.html @@ -0,0 +1,82 @@ +
+
+ +

Podmínky užití a licenční podmínky

+

+ Tyto Podmínky užití a licenční podmínky (dále jen „Podmínky“) upravují podmínky stažení a užití Datasetu, který + se skládá z článků z webů Novinky.cz a Seznamzpravy.cz (dále jen „Dataset“) +

+

+ Veškerými právy k jednotlivým článkům Datasetu disponují společnost Seznam.cz, a.s., zápis v obchodním + rejstříku: spisová značka B 6493 vedená u Městského soudu v Praze, se sídlem: Praha 5 - Smíchov, Radlická + 3294/10, PSČ: 15000, IČO: 26168685 (dále „Seznam.cz" nebo „společnost Seznam.cz“) jako provozovatel portálu + Novinky.cz, a dále dle typu média Seznam Zprávy, a.s., zápis v obchodním rejstříku: spisová značka. B 26792 + vedená Městským soudem v Praze se sídlem Praha 5, Radlická 3294/10, PSČ: 15000, IČO: 13974475, (dále + „Seznam Zprávy" nebo „společnost Seznam Zprávy“) jako dodavatel obsahu pro Seznamzpravy.cz nebo + společnost BORGIS a.s., zápis v obchodním rejstříku: spisová značka B 267 vedená u Městského soudu v Praze, + se sídlem: Praha 2, Slezská 2127/13, PSČ: 12150, IČO: 00564893 (dále jen „BORGIS" nebo „společnost BORGIS“) + jako dodavatel obsahu pro Novinky.cz. (Společnost Seznam.cz, Seznam Zprávy a BORGIS společně jsou dále + označeni jako Poskytovatelé). +

+

+ Registrací vyjadřuje uživatel (dále jen „Uživatel“) svůj souhlas s těmito Podmínkami a stvrzuje, že je plně + odpovědný za užití Datasetu v souladu s těmito Podmínkami. Podmínky se vztahují na Dataset jako celek i na + jeho jednotlivé části. +

+

+ Uživatel bere na vědomí, že Dataset je chráněn autorským zákonem a zákonem o ochranných známkách, vážou + se k němu práva Poskytovatelů, obsahuje osobní údaje a manipulace s ním je tedy omezena. Použití Datasetu a + jeho obsahu je možné výhradně způsobem a v rozsahu uvedeném v těchto Podmínkách. +

+

+ Stažení a následné užívání Datasetu je možné následovně: +

+

+ Uživatel je oprávněn užívat Dataset výlučně za vědeckými a výzkumnými účely, především v souvislosti + s výzkumem multimodální sumarizace, jejichž cílem není dosažení přímého nebo nepřímého obchodního + prospěchu. Uživatel není oprávněn Dataset užívat takovým způsobem, který by byl: v rozporu s právním řádem + České republiky či porušující práva třetích osob; v rozporu s dobrými mravy, případně ohrožují veřejný pořádek; + způsobilý přivodit újmu Poskytovatelům či třetím osobám, odporující pravidlům či podmínkám stanoveným + Poskytovateli nebo zájmům Poskytovatelů či třetích osob. Dataset ani jeho část nesmí být použit k trénování + nebo být jakoukoliv součástí veřejně dostupného jazykového modelu umělé inteligence. +

+

+ Uživatel nebude nijak replikovat Dataset ani jej jinak zpřístupňovat veřejnosti nebo jej umisťovat na jiné webové + stránky. +

+

+ Uživatel se zavazuje respektovat osobnostní a majetková práva autorů. Poskytovatelů a všech subjektů údajů. +

+

+ Oznámí-li Matematicko-fyzikální fakulta Univerzity Karlovy Uživatelům aktualizaci verze Datasetu, zejména, + pokud některý ze subjektů údajů uplatní svá práva, je Uživatel povinen původní verzi odstranit a užívat novou + verzi. +

+

+ Veškerá oprávnění k užití Datasetu jsou nevýhradní, nepřevoditelná a nepostupitelná. Uživatel není oprávněn + udělit třetí osobě podlicenci. +

+

+ Poskytovatelé neposkytují žádné záruky týkající se funkčnosti, kvality, obsahu, dostupnosti či výkonu ve vztahu + ke shora uvedenému účelu užívání a neodpovídají za jakoukoliv škodu či újmu (vč. ušlého zisku či jiných nároků), + která by mohla Uživateli v souvislosti s užitím Datasetu vzniknout. +

+

+ Poskytovatelé nijak nezpracovávají osobní údaje Uživatelů. Za zajištění zpracování osobních údajů v souladu s + právními předpisy upravujícími ochranu osobních údajů odpovídá Matematicko-fyzikální fakulta Univerzity + Karlovy. +

+

+ Tyto Podmínky se řídí platnými zákony a dalšími právními předpisy České republiky a jsou závazné pro všechny + strany. +

+

+ Uživatel akceptací těchto Podmínek potvrzuje, že byl s těmito Smluvními podmínkami seznámen v plném + rozsahu a zavazuje se jimi řídit. +

+

+ Tyto Podmínky jsou platné a účinné od 10.10.2023. +

+ +
+
diff --git a/src/static-files/szn-dataset-license.html b/src/static-files/szn-dataset-license.html new file mode 100644 index 00000000000..8409cd182a3 --- /dev/null +++ b/src/static-files/szn-dataset-license.html @@ -0,0 +1,48 @@ +
+
+ +

Terms of Use and License Terms

+

+ These Terms of Use and License Terms (hereinafter referred to as "Terms") regulate the terms and conditions for downloading and using the Dataset, which consists of articles from the Novinky.cz and Seznamzpravy.cz websites (hereinafter referred to as "Dataset"). +

+

+ All rights to individual articles of the Dataset are held by Seznam.cz, a.s., with its registered office at Praha 5 – Smíchov, Radlická 3294/10, Postcode 15000, Company ID No. 26168685, registered in the Commercial Register maintained by the Municipal Court in Prague, Section B, Entry 6493 (hereinafter referred to as "Seznam.cz") as the operator of the Novinky.cz portal, and further, according to the type of media: Seznam Zprávy, a.s., with its registered office at Praha 5 – Smíchov, Radlická 3294/10, Postcode 15000, Company ID No. 13974475, registered in the Commercial Register maintained by the Municipal Court in Prague, Section B, Entry 26792, (hereinafter referred to as "Seznam Zprávy" ) as a content supplier for Seznamzpravy.cz; or BORGIS a.s., with its registered office at Praha 2, Slezská 2127/13, Postcode 12150, Company ID No. 00564893, registered in the Commercial Register maintained by the Municipal Court in Prague, Section B, Entry 267 (hereinafter referred to as "BORGIS" ) as a content supplier for Novinky.cz. (Seznam.cz, Seznam Zprávy and BORGIS are hereinafter jointly referred to as „Providers “). +

+

+ By registering, the user (hereinafter referred to as "User") expresses their agreement with these Terms and confirms that they are fully responsible for the use of the Dataset in accordance with these Terms. The Terms apply to the Dataset as a whole and to its components. +

+

+ The User acknowledges that the Dataset is protected by Copyright and Trademark Acts, is subject to the rights of the Providers, contains personal data therefore its handling is restricted. The Dataset and its contents may only be used in the manner and the scope specified in these Terms. +

+

+ Download and subsequent use of the Dataset is possible as follows: + The User is entitled to use the Dataset exclusively for scientific and research purposes, in particular in connection with research on multimodal aggregation, which are not intended to achieve direct or indirect commercial benefit. The User shall not be entitled to use the Dataset in such a way that would: breach the legislation of the Czech Republic; infringe third party rights or violating the rights of third parties; breach good manners or threaten public order, might harm the Providers or third parties; breach the rules or conditions determined by the Providers, the Providers’ interests or interests of third parties. The Dataset or any component may not be used for training or be any part of a publicly available artificial intelligence language model. +

+

+ The User shall not replicate the Dataset in any way or otherwise make it available to the public or place it on other websites. +

+

+ The User undertakes to respect the personal and property rights of the authors, Providers, and all data subjects. + If the Faculty of Mathematics and Physics of Charles University notifies Users of an update of the version of the Dataset, in particular if any of the data subjects exercise their rights, the User is obliged to remove the original version and use the updated version. +

+

+ All rights to use the Dataset are non-exclusive, non-transferable, and non-assignable. The User is not entitled to grant a sub-license to a third party. +

+

+ The Providers make no warranties concerning the functionality, quality, content, availability, or performance in relation to the foregoing purpose of use and shall not be liable for any damage or injury (including lost profits or other claims) that may arise to the User in connection with the use of the Dataset. +

+

+ Providers do not process Users' personal data in any way. The Faculty of Mathematics and Physics of Charles University is responsible for ensuring the processing of personal data in accordance with the legal regulations governing the protection of personal data. +

+

+ These Terms shall be governed by applicable laws and regulations of the Czech Republic and are binding on all parties. +

+

+ By accepting these Terms, the User confirms that he/she has read these Terms in full and agrees to be bound by them. +

+

+ These Terms come into force and take effect on Oct 10, 2023. +

+ +
+
From 617ace51758195a16dfe4e27fbaff6b0fe78db3b Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 14 Oct 2024 15:59:44 +0200 Subject: [PATCH 2/5] Refactored fetching html content from the static files. The logic was moved into the common service. --- src/app/shared/html-content.service.ts | 37 ++++++++++++++++++- .../static-page/static-page.component.spec.ts | 13 ++----- src/app/static-page/static-page.component.ts | 34 ++--------------- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/app/shared/html-content.service.ts b/src/app/shared/html-content.service.ts index 0120c591ac2..23142319c0e 100644 --- a/src/app/shared/html-content.service.ts +++ b/src/app/shared/html-content.service.ts @@ -1,14 +1,18 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { catchError } from 'rxjs/operators'; -import { of as observableOf } from 'rxjs'; +import {firstValueFrom, of as observableOf} from 'rxjs'; +import {HTML_SUFFIX, STATIC_FILES_PROJECT_PATH} from '../static-page/static-page-routing-paths'; +import {isEmpty, isNotEmpty} from './empty.util'; +import {LocaleService} from '../core/locale/locale.service'; /** * Service for loading static `.html` files stored in the `/static-files` folder. */ @Injectable() export class HtmlContentService { - constructor(private http: HttpClient) {} + constructor(private http: HttpClient, + private localeService: LocaleService,) {} /** * Load `.html` file content or return empty string if an error. @@ -19,4 +23,33 @@ export class HtmlContentService { return this.http.get(url, { responseType: 'text' }).pipe( catchError(() => observableOf(''))); } + + /** + * Get the html file content as a string by the file name and the current locale. + */ + async getHmtlContentByPathAndLocale(fileName: string) { + let url = ''; + // Get current language + let language = this.localeService.getCurrentLanguageCode(); + // If language is default = `en` do not load static files from translated package e.g. `cs`. + language = language === 'en' ? '' : language; + + // Try to find the html file in the translated package. `static-files/language_code/some_file.html` + // Compose url + url = STATIC_FILES_PROJECT_PATH; + url += isEmpty(language) ? '/' + fileName : '/' + language + '/' + fileName; + // Add `.html` suffix to get the current html file + url = url.endsWith(HTML_SUFFIX) ? url : url + HTML_SUFFIX; + let potentialContent = await firstValueFrom(this.fetchHtmlContent(url)); + if (isNotEmpty(potentialContent)) { + return potentialContent; + } + + // If the file wasn't find, get the non-translated file from the default package. + url = STATIC_FILES_PROJECT_PATH + '/' + fileName; + potentialContent = await firstValueFrom(this.fetchHtmlContent(url)); + if (isNotEmpty(potentialContent)) { + return potentialContent; + } + } } diff --git a/src/app/static-page/static-page.component.spec.ts b/src/app/static-page/static-page.component.spec.ts index 97df3c3d420..1ad4e607c3c 100644 --- a/src/app/static-page/static-page.component.spec.ts +++ b/src/app/static-page/static-page.component.spec.ts @@ -4,7 +4,6 @@ import { StaticPageComponent } from './static-page.component'; import { HtmlContentService } from '../shared/html-content.service'; import { Router } from '@angular/router'; import { RouterMock } from '../shared/mocks/router.mock'; -import { LocaleService } from '../core/locale/locale.service'; import { TranslateModule } from '@ngx-translate/core'; import { of } from 'rxjs'; import { APP_CONFIG } from '../../config/app-config.interface'; @@ -16,15 +15,14 @@ describe('StaticPageComponent', () => { let fixture: ComponentFixture; let htmlContentService: HtmlContentService; - let localeService: any; let appConfig: any; + const htmlContent = '
TEST MESSAGE
'; + beforeEach(async () => { htmlContentService = jasmine.createSpyObj('htmlContentService', { - fetchHtmlContent: of('
TEST MESSAGE
') - }); - localeService = jasmine.createSpyObj('LocaleService', { - getCurrentLanguageCode: jasmine.createSpy('getCurrentLanguageCode'), + fetchHtmlContent: of(htmlContent), + getHmtlContentByPathAndLocale: Promise.resolve(htmlContent) }); appConfig = Object.assign(environment, { @@ -41,13 +39,10 @@ describe('StaticPageComponent', () => { providers: [ { provide: HtmlContentService, useValue: htmlContentService }, { provide: Router, useValue: new RouterMock() }, - { provide: LocaleService, useValue: localeService }, { provide: APP_CONFIG, useValue: appConfig } ] }); - localeService = TestBed.inject(LocaleService); - localeService.getCurrentLanguageCode.and.returnValue('en'); }); beforeEach(() => { diff --git a/src/app/static-page/static-page.component.ts b/src/app/static-page/static-page.component.ts index c44d5fb6ebd..ac148e41c3e 100644 --- a/src/app/static-page/static-page.component.ts +++ b/src/app/static-page/static-page.component.ts @@ -3,12 +3,7 @@ import { HtmlContentService } from '../shared/html-content.service'; import { BehaviorSubject, firstValueFrom } from 'rxjs'; import { Router } from '@angular/router'; import { isEmpty, isNotEmpty } from '../shared/empty.util'; -import { LocaleService } from '../core/locale/locale.service'; -import { - HTML_SUFFIX, - STATIC_FILES_DEFAULT_ERROR_PAGE_PATH, - STATIC_FILES_PROJECT_PATH, STATIC_PAGE_PATH -} from './static-page-routing-paths'; +import { STATIC_FILES_DEFAULT_ERROR_PAGE_PATH, STATIC_PAGE_PATH } from './static-page-routing-paths'; import { APP_CONFIG, AppConfig } from '../../config/app-config.interface'; /** @@ -26,36 +21,15 @@ export class StaticPageComponent implements OnInit { constructor(private htmlContentService: HtmlContentService, private router: Router, - private localeService: LocaleService, @Inject(APP_CONFIG) protected appConfig?: AppConfig) { } async ngOnInit(): Promise { - let url = ''; // Fetch html file name from the url path. `static/some_file.html` this.htmlFileName = this.getHtmlFileName(); - // Get current language - let language = this.localeService.getCurrentLanguageCode(); - // If language is default = `en` do not load static files from translated package e.g. `cs`. - language = language === 'en' ? '' : language; - - // Try to find the html file in the translated package. `static-files/language_code/some_file.html` - // Compose url - url = STATIC_FILES_PROJECT_PATH; - url += isEmpty(language) ? '/' + this.htmlFileName : '/' + language + '/' + this.htmlFileName; - // Add `.html` suffix to get the current html file - url = url.endsWith(HTML_SUFFIX) ? url : url + HTML_SUFFIX; - let potentialContent = await firstValueFrom(this.htmlContentService.fetchHtmlContent(url)); - if (isNotEmpty(potentialContent)) { - this.htmlContent.next(potentialContent); - return; - } - - // If the file wasn't find, get the non-translated file from the default package. - url = STATIC_FILES_PROJECT_PATH + '/' + this.htmlFileName; - potentialContent = await firstValueFrom(this.htmlContentService.fetchHtmlContent(url)); - if (isNotEmpty(potentialContent)) { - this.htmlContent.next(potentialContent); + const htmlContent = await this.htmlContentService.getHmtlContentByPathAndLocale(this.htmlFileName); + if (isNotEmpty(htmlContent)) { + this.htmlContent.next(htmlContent); return; } From 2d2290ecd7f4951dcf38899674f54b6d409792a3 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 14 Oct 2024 16:02:55 +0200 Subject: [PATCH 3/5] Show Seznam static license on approval page. --- ...arin-license-agreement-page.component.html | 4 +++ ...clarin-license-agreement-page.component.ts | 29 ++++++++++++++++++- 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.html b/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.html index b73952718d5..99d77f87780 100644 --- a/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.html +++ b/src/app/bitstream-page/clarin-license-agreement-page/clarin-license-agreement-page.component.html @@ -14,6 +14,10 @@