Display changelog from current version to latest upon clicking the update link
This commit is contained in:
committed by
Aditya Chandel
parent
b708976c1b
commit
6af3ee7019
+13
-29
@@ -1,46 +1,30 @@
|
||||
package com.adityachandel.booklore.controller;
|
||||
|
||||
import com.adityachandel.booklore.model.dto.ReleaseNote;
|
||||
import com.adityachandel.booklore.model.dto.VersionInfo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import com.adityachandel.booklore.service.VersionService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/version")
|
||||
public class VersionController {
|
||||
|
||||
@Value("${app.version:unknown}")
|
||||
private String appVersion;
|
||||
private final VersionService versionService;
|
||||
|
||||
@GetMapping
|
||||
public ResponseEntity<VersionInfo> getVersions() {
|
||||
String latestVersion = fetchLatestGitHubReleaseVersion();
|
||||
return ResponseEntity.ok(new VersionInfo(appVersion, latestVersion));
|
||||
public ResponseEntity<VersionInfo> getVersionInfo() {
|
||||
return ResponseEntity.ok(versionService.getVersionInfo());
|
||||
}
|
||||
|
||||
private String fetchLatestGitHubReleaseVersion() {
|
||||
try {
|
||||
RestClient restClient = RestClient.builder()
|
||||
.defaultHeader("Accept", "application/vnd.github+json")
|
||||
.defaultHeader("User-Agent", "BookLore-Version-Checker")
|
||||
.build();
|
||||
|
||||
String response = restClient.get()
|
||||
.uri("https://api.github.com/repos/adityachandelgit/BookLore/releases/latest")
|
||||
.retrieve()
|
||||
.body(String.class);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode root = objectMapper.readTree(response);
|
||||
return root.has("tag_name") ? root.get("tag_name").asText() : "unknown";
|
||||
|
||||
} catch (Exception e) {
|
||||
return "unknown";
|
||||
}
|
||||
@GetMapping("/changelog")
|
||||
public ResponseEntity<List<ReleaseNote>> getChangelogSinceCurrent() {
|
||||
return ResponseEntity.ok(versionService.getChangelogSinceCurrentVersion());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.adityachandel.booklore.model.dto;
|
||||
|
||||
public record ReleaseNote(String version, String name, String changelog, String url) {
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
package com.adityachandel.booklore.model.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class VersionInfo {
|
||||
private String current;
|
||||
private String latest;
|
||||
public record VersionInfo(String current, String latest) {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.adityachandel.booklore.service;
|
||||
|
||||
import com.adityachandel.booklore.model.dto.ReleaseNote;
|
||||
import com.adityachandel.booklore.model.dto.VersionInfo;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestClient;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class VersionService {
|
||||
|
||||
@Value("${app.version:unknown}")
|
||||
private String appVersion;
|
||||
|
||||
private static final String GITHUB_REPO = "adityachandelgit/BookLore";
|
||||
|
||||
public VersionInfo getVersionInfo() {
|
||||
String latestVersion = fetchLatestGitHubReleaseVersion();
|
||||
return new VersionInfo(appVersion, latestVersion);
|
||||
}
|
||||
|
||||
public List<ReleaseNote> getChangelogSinceCurrentVersion() {
|
||||
return fetchReleaseNotesSince(appVersion);
|
||||
}
|
||||
|
||||
private String fetchLatestGitHubReleaseVersion() {
|
||||
try {
|
||||
RestClient restClient = RestClient.builder()
|
||||
.defaultHeader("Accept", "application/vnd.github+json")
|
||||
.defaultHeader("User-Agent", "BookLore-Version-Checker")
|
||||
.build();
|
||||
|
||||
String response = restClient.get()
|
||||
.uri("https://api.github.com/repos/" + GITHUB_REPO + "/releases/latest")
|
||||
.retrieve()
|
||||
.body(String.class);
|
||||
|
||||
JsonNode root = new ObjectMapper().readTree(response);
|
||||
return root.has("tag_name") ? root.get("tag_name").asText() : "unknown";
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to fetch latest release version", e);
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
private List<ReleaseNote> fetchReleaseNotesSince(String currentVersion) {
|
||||
List<ReleaseNote> updates = new ArrayList<>();
|
||||
try {
|
||||
RestClient restClient = RestClient.builder()
|
||||
.defaultHeader("Accept", "application/vnd.github+json")
|
||||
.defaultHeader("User-Agent", "BookLore-Version-Checker")
|
||||
.build();
|
||||
|
||||
String response = restClient.get()
|
||||
.uri("https://api.github.com/repos/" + GITHUB_REPO + "/releases")
|
||||
.retrieve()
|
||||
.body(String.class);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
JsonNode releases = mapper.readTree(response);
|
||||
|
||||
for (JsonNode release : releases) {
|
||||
String tag = release.get("tag_name").asText();
|
||||
if (isVersionGreater(tag, currentVersion)) {
|
||||
String url = "https://github.com/" + GITHUB_REPO + "/releases/tag/" + tag;
|
||||
updates.add(new ReleaseNote(
|
||||
tag,
|
||||
release.get("name").asText(),
|
||||
release.get("body").asText(),
|
||||
url
|
||||
));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to fetch release notes", e);
|
||||
}
|
||||
return updates;
|
||||
}
|
||||
|
||||
private boolean isVersionGreater(String version1, String version2) {
|
||||
try {
|
||||
String[] v1 = version1.replace("v", "").split("\\.");
|
||||
String[] v2 = version2.replace("v", "").split("\\.");
|
||||
for (int i = 0; i < Math.max(v1.length, v2.length); i++) {
|
||||
int num1 = i < v1.length ? Integer.parseInt(v1[i]) : 0;
|
||||
int num2 = i < v2.length ? Integer.parseInt(v2[i]) : 0;
|
||||
if (num1 > num2) return true;
|
||||
if (num1 < num2) return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Version comparison failed", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
app:
|
||||
path-book: '/app/books'
|
||||
path-config: '/app/data'
|
||||
version: 'development'
|
||||
version: 'v0.0.40'
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
|
||||
Generated
+83
-4
@@ -30,6 +30,7 @@
|
||||
"primeng": "19.0.10",
|
||||
"quill": "2.0.3",
|
||||
"rxjs": "7.8.2",
|
||||
"showdown": "^2.1.0",
|
||||
"tailwindcss-primeui": "0.6.1",
|
||||
"tslib": "2.8.1",
|
||||
"ws": "8.18.1",
|
||||
@@ -39,7 +40,9 @@
|
||||
"@angular-devkit/build-angular": "19.2.7",
|
||||
"@angular/cli": "19.2.7",
|
||||
"@angular/compiler-cli": "19.2.6",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@types/jasmine": "5.1.7",
|
||||
"@types/showdown": "^2.0.6",
|
||||
"angular-eslint": "19.3.0",
|
||||
"autoprefixer": "10.4.21",
|
||||
"eslint": "9.24.0",
|
||||
@@ -5981,6 +5984,36 @@
|
||||
"integrity": "sha512-1ZIUqtPITFbv/DxRmDr5/agPqJwF69d24m9qmM1939TJehgY539CtzeZRjbLt5G6fSy/7YqqYsfvoTEw9xUI2A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@tailwindcss/typography": {
|
||||
"version": "0.5.16",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/typography/-/typography-0.5.16.tgz",
|
||||
"integrity": "sha512-0wDLwCVF5V3x3b1SGXPCDcdsbDHMBe+lkFzBRaHeLvNi+nrrnZ1lA18u+OTWO8iSWU2GxUOCvlXtDuqftc1oiA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lodash.castarray": "^4.4.0",
|
||||
"lodash.isplainobject": "^4.0.6",
|
||||
"lodash.merge": "^4.6.2",
|
||||
"postcss-selector-parser": "6.0.10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@tailwindcss/typography/node_modules/postcss-selector-parser": {
|
||||
"version": "6.0.10",
|
||||
"resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz",
|
||||
"integrity": "sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cssesc": "^3.0.0",
|
||||
"util-deprecate": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/@tufjs/canonical-json": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@tufjs/canonical-json/-/canonical-json-2.0.0.tgz",
|
||||
@@ -6287,6 +6320,13 @@
|
||||
"@types/send": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/showdown": {
|
||||
"version": "2.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/showdown/-/showdown-2.0.6.tgz",
|
||||
"integrity": "sha512-pTvD/0CIeqe4x23+YJWlX2gArHa8G0J0Oh6GKaVXV7TAeickpkkZiNOgFcFcmLQ5lB/K0qBJL1FtRYltBfbGCQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/sockjs": {
|
||||
"version": "0.3.36",
|
||||
"resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz",
|
||||
@@ -11867,6 +11907,13 @@
|
||||
"integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.castarray": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.castarray/-/lodash.castarray-4.4.0.tgz",
|
||||
"integrity": "sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.clonedeep": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
|
||||
@@ -11886,6 +11933,13 @@
|
||||
"integrity": "sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.isplainobject": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz",
|
||||
"integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/lodash.merge": {
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
|
||||
@@ -15217,6 +15271,31 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/showdown/-/showdown-2.1.0.tgz",
|
||||
"integrity": "sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"commander": "^9.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"showdown": "bin/showdown.js"
|
||||
},
|
||||
"funding": {
|
||||
"type": "individual",
|
||||
"url": "https://www.paypal.me/tiviesantos"
|
||||
}
|
||||
},
|
||||
"node_modules/showdown/node_modules/commander": {
|
||||
"version": "9.5.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
|
||||
"integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/side-channel": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz",
|
||||
@@ -16938,9 +17017,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "9.0.1",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz",
|
||||
"integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==",
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz",
|
||||
"integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==",
|
||||
"funding": [
|
||||
"https://github.com/sponsors/broofa",
|
||||
"https://github.com/sponsors/ctavan"
|
||||
@@ -16948,7 +17027,7 @@
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
"uuid": "dist/esm/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/validate-npm-package-license": {
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
"primeng": "19.0.10",
|
||||
"quill": "2.0.3",
|
||||
"rxjs": "7.8.2",
|
||||
"showdown": "^2.1.0",
|
||||
"tailwindcss-primeui": "0.6.1",
|
||||
"tslib": "2.8.1",
|
||||
"ws": "8.18.1",
|
||||
@@ -42,7 +43,9 @@
|
||||
"@angular-devkit/build-angular": "19.2.7",
|
||||
"@angular/cli": "19.2.7",
|
||||
"@angular/compiler-cli": "19.2.6",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@types/jasmine": "5.1.7",
|
||||
"@types/showdown": "^2.0.6",
|
||||
"angular-eslint": "19.3.0",
|
||||
"autoprefixer": "10.4.21",
|
||||
"eslint": "9.24.0",
|
||||
|
||||
@@ -8,6 +8,13 @@ export interface AppVersion {
|
||||
latest: string;
|
||||
}
|
||||
|
||||
export interface ReleaseNote {
|
||||
version: string;
|
||||
name: string;
|
||||
changelog: string;
|
||||
url: string;
|
||||
}
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@@ -19,4 +26,8 @@ export class VersionService {
|
||||
getVersion(): Observable<AppVersion> {
|
||||
return this.http.get<AppVersion>(this.versionUrl);
|
||||
}
|
||||
|
||||
getChangelog(): Observable<ReleaseNote[]> {
|
||||
return this.http.get<ReleaseNote[]>(`${this.versionUrl}/changelog`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,10 +42,8 @@
|
||||
</div>
|
||||
<div *ngIf="versionInfo.latest && versionInfo.latest !== versionInfo.current">
|
||||
<a
|
||||
[href]="getVersionUrl(versionInfo.latest)"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="text-orange-400 hover:underline hover:text-orange-300 text-xs"
|
||||
(click)="openChangelogDialog()"
|
||||
class="cursor-pointer text-orange-400 hover:underline hover:text-orange-300 text-xs"
|
||||
>
|
||||
(Update)
|
||||
</a>
|
||||
|
||||
@@ -9,6 +9,8 @@ import {ShelfService} from '../../../book/service/shelf.service';
|
||||
import {BookService} from '../../../book/service/book.service';
|
||||
import {LibraryShelfMenuService} from '../../../book/service/library-shelf-menu.service';
|
||||
import {AppVersion, VersionService} from '../../../core/service/version.service';
|
||||
import {DialogService, DynamicDialogRef} from 'primeng/dynamicdialog';
|
||||
import {VersionChangelogDialogComponent} from './version-changelog-dialog/version-changelog-dialog.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-menu',
|
||||
@@ -21,12 +23,15 @@ export class AppMenuComponent implements OnInit {
|
||||
homeMenu$: Observable<any> | undefined;
|
||||
|
||||
versionInfo: AppVersion | null = null;
|
||||
dynamicDialogRef: DynamicDialogRef | undefined;
|
||||
|
||||
private libraryService = inject(LibraryService);
|
||||
private shelfService = inject(ShelfService);
|
||||
private bookService = inject(BookService);
|
||||
private versionService = inject(VersionService);
|
||||
private libraryShelfMenuService = inject(LibraryShelfMenuService);
|
||||
private dialogService = inject(DialogService);
|
||||
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
@@ -94,6 +99,20 @@ export class AppMenuComponent implements OnInit {
|
||||
);
|
||||
}
|
||||
|
||||
openChangelogDialog() {
|
||||
this.dynamicDialogRef = this.dialogService.open(VersionChangelogDialogComponent, {
|
||||
header: 'What’s New',
|
||||
modal: true,
|
||||
closable: true,
|
||||
style: {
|
||||
position: 'absolute',
|
||||
top: '10%',
|
||||
bottom: '10%',
|
||||
minWidth: '800px',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
getVersionUrl(version: string | undefined): string {
|
||||
if (!version) return '#';
|
||||
if (version.startsWith('v')) {
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<div *ngIf="loading" class="p-4 text-center text-gray-400">
|
||||
Loading changelog...
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loading && changelog.length === 0" class="p-4 text-center text-gray-400">
|
||||
No updates available.
|
||||
</div>
|
||||
|
||||
<div *ngIf="!loading && changelog.length > 0" class="space-y-6 p-4 max-h-[70vh] overflow-auto">
|
||||
<div *ngFor="let release of changelog" class="border-b pb-4">
|
||||
<p class="font-bold text-2xl pb-2">
|
||||
<a [href]="release.url" target="_blank" rel="noopener noreferrer" class="text-blue-400 hover:underline">
|
||||
{{ release.name }}
|
||||
</a>
|
||||
</p>
|
||||
<div [innerHTML]="markdownToHtml(release.changelog)" class="prose prose-invert w-full max-w-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
:host ::ng-deep .prose h3 {
|
||||
margin-top: 0px;
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import { Component, inject, OnInit } from '@angular/core';
|
||||
import { ReleaseNote, VersionService } from '../../../../core/service/version.service';
|
||||
import { NgForOf, NgIf } from '@angular/common';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import showdown from 'showdown';
|
||||
|
||||
@Component({
|
||||
selector: 'app-version-changelog-dialog',
|
||||
standalone: true,
|
||||
imports: [NgIf, NgForOf],
|
||||
templateUrl: './version-changelog-dialog.component.html',
|
||||
styleUrl: './version-changelog-dialog.component.scss'
|
||||
})
|
||||
export class VersionChangelogDialogComponent implements OnInit {
|
||||
|
||||
private versionService = inject(VersionService);
|
||||
private sanitizer = inject(DomSanitizer);
|
||||
|
||||
changelog: ReleaseNote[] = [];
|
||||
loading = true;
|
||||
|
||||
private converter = new showdown.Converter({ tables: true, emoji: true });
|
||||
|
||||
ngOnInit(): void {
|
||||
this.versionService.getChangelog().subscribe({
|
||||
next: (data) => {
|
||||
this.changelog = data;
|
||||
this.loading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.loading = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
markdownToHtml(markdown: string): SafeHtml {
|
||||
let html = this.converter.makeHtml(markdown);
|
||||
html = html.replace(/<h2\b([^>]*)>/g, '<h3$1>').replace(/<\/h2>/g, '</h3>');
|
||||
return this.sanitizer.bypassSecurityTrustHtml(html);
|
||||
}
|
||||
}
|
||||
+14
-14
@@ -1,18 +1,18 @@
|
||||
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
||||
import { DialogService } from 'primeng/dynamicdialog';
|
||||
import { ConfirmationService, MessageService } from 'primeng/api';
|
||||
import { RxStompService } from './app/shared/websocket/rx-stomp.service';
|
||||
import { rxStompServiceFactory } from './app/shared/websocket/rx-stomp-service-factory';
|
||||
import { provideRouter, RouteReuseStrategy } from '@angular/router';
|
||||
import { CustomReuseStrategy } from './app/custom-reuse-strategy';
|
||||
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
||||
import { providePrimeNG } from 'primeng/config';
|
||||
import { bootstrapApplication } from '@angular/platform-browser';
|
||||
import { AppComponent } from './app/app.component';
|
||||
import {provideHttpClient, withInterceptors} from '@angular/common/http';
|
||||
import {DialogService} from 'primeng/dynamicdialog';
|
||||
import {ConfirmationService, MessageService} from 'primeng/api';
|
||||
import {RxStompService} from './app/shared/websocket/rx-stomp.service';
|
||||
import {rxStompServiceFactory} from './app/shared/websocket/rx-stomp-service-factory';
|
||||
import {provideRouter, RouteReuseStrategy} from '@angular/router';
|
||||
import {CustomReuseStrategy} from './app/custom-reuse-strategy';
|
||||
import {provideAnimationsAsync} from '@angular/platform-browser/animations/async';
|
||||
import {providePrimeNG} from 'primeng/config';
|
||||
import {bootstrapApplication} from '@angular/platform-browser';
|
||||
import {AppComponent} from './app/app.component';
|
||||
import Aura from '@primeng/themes/aura';
|
||||
import { routes } from './app/app.routes';
|
||||
import { AuthInterceptorService } from './app/auth-interceptor.service';
|
||||
import { AuthService } from './app/core/service/auth.service';
|
||||
import {routes} from './app/app.routes';
|
||||
import {AuthInterceptorService} from './app/auth-interceptor.service';
|
||||
import {AuthService} from './app/core/service/auth.service';
|
||||
|
||||
bootstrapApplication(AppComponent, {
|
||||
providers: [
|
||||
|
||||
@@ -6,6 +6,9 @@ module.exports = {
|
||||
theme: {
|
||||
extend: {},
|
||||
},
|
||||
plugins: [require('tailwindcss-primeui')]
|
||||
plugins: [
|
||||
require('tailwindcss-primeui'),
|
||||
require('@tailwindcss/typography')
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user