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

Revert "Move default media files to regional storage (#2407)" #2461

Merged
merged 1 commit into from
Apr 12, 2024
Merged
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
27 changes: 1 addition & 26 deletions src/services/provisioningService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import * as Constants from "../constants";
import { MapiClient } from "./mapiClient";
import { KnownMimeTypes } from "../models/knownMimeTypes";
import { KnownHttpHeaders } from "../models/knownHttpHeaders";
import { ISettingsProvider } from "@paperbits/common/configuration";

export class ProvisionService {
constructor(
Expand All @@ -16,8 +15,7 @@ export class ProvisionService {
private readonly authenticator: IAuthenticator,
private readonly viewManager: ViewManager,
private readonly router: Router,
private readonly blobStorage: AzureBlobStorage,
private readonly settingsProvider: ISettingsProvider
private readonly blobStorage: AzureBlobStorage
) { }

private async fetchData(url: string): Promise<Object> {
Expand All @@ -29,9 +27,6 @@ export class ProvisionService {
const dataUrl = `/editors/templates/default.json`;
const dataObj = await this.fetchData(dataUrl);
const keys = Object.keys(dataObj);

await this.setUpDefaultContent(dataObj);

const accessToken = await this.authenticator.getAccessTokenAsString();

if (!accessToken) {
Expand Down Expand Up @@ -111,24 +106,4 @@ export class ProvisionService {
await this.cleanupBlobs();
await this.cleanupContent();
}

private async setUpDefaultContent(dataObj: object): Promise<void> {
const backendUrl = await this.settingsProvider.getSetting<string>("backendUrl") || `https://${location.hostname}`;
const defaultMedias: { [name: string]: string } = {
"hero-gradient": "hero-gradient.jpg",
"featured-1": "featured-1.jpg",
"featured-2": "featured-2.jpg",
"featured-3": "featured-3.jpg",
"contoso-black": "contoso-black.png",
"logo-contoso-small": "logo-contoso-small.png"
}

const keyPath = "/contentTypes/blob/contentItems";
const downloadUrl = "/assets/images/";

for (const key in defaultMedias) {
const media = defaultMedias[key];
dataObj[`${keyPath}/${key}`]["properties"]["downloadUrl"] = backendUrl + downloadUrl + media;
}
}
}
Binary file removed src/themes/website/images/contoso-black.png
Binary file not shown.
Binary file removed src/themes/website/images/featured-1.jpg
Binary file not shown.
Binary file removed src/themes/website/images/featured-2.jpg
Binary file not shown.
Binary file removed src/themes/website/images/featured-3.jpg
Binary file not shown.
Binary file removed src/themes/website/images/hero-gradient.jpg
Binary file not shown.
Binary file removed src/themes/website/images/logo-contoso-small.png
Binary file not shown.
2 changes: 1 addition & 1 deletion templates/default.json

Large diffs are not rendered by default.

Loading