修复TG一些邮件和图片不显示
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { S3Client, PutObjectCommand, DeleteObjectsCommand } from "@aws-sdk/client-s3";
|
import { S3Client, PutObjectCommand, DeleteObjectsCommand } from "@aws-sdk/client-s3";
|
||||||
import settingService from './setting-service';
|
import settingService from './setting-service';
|
||||||
import domainUtils from '../utils/domain-uitls';
|
import domainUtils from '../utils/domain-uitls';
|
||||||
|
import { settingConst } from '../const/entity-const';
|
||||||
const s3Service = {
|
const s3Service = {
|
||||||
|
|
||||||
async putObj(c, key, content, metadata) {
|
async putObj(c, key, content, metadata) {
|
||||||
@@ -76,10 +77,11 @@ const s3Service = {
|
|||||||
|
|
||||||
|
|
||||||
async client(c) {
|
async client(c) {
|
||||||
const { region, endpoint, s3AccessKey, s3SecretKey } = await settingService.query(c);
|
const { region, endpoint, s3AccessKey, s3SecretKey, forcePathStyle } = await settingService.query(c);
|
||||||
return new S3Client({
|
return new S3Client({
|
||||||
region: region || 'auto',
|
region: region || 'auto',
|
||||||
endpoint: domainUtils.toOssDomain(endpoint),
|
endpoint: domainUtils.toOssDomain(endpoint),
|
||||||
|
forcePathStyle: forcePathStyle === settingConst.forcePathStyle.OPEN,
|
||||||
credentials: {
|
credentials: {
|
||||||
accessKeyId: s3AccessKey,
|
accessKeyId: s3AccessKey,
|
||||||
secretAccessKey: s3SecretKey,
|
secretAccessKey: s3SecretKey,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ export default function emailHtmlTemplate(html, domain) {
|
|||||||
|
|
||||||
const { document } = parseHTML(html);
|
const { document } = parseHTML(html);
|
||||||
document.querySelectorAll('script').forEach(script => script.remove());
|
document.querySelectorAll('script').forEach(script => script.remove());
|
||||||
html = document.documentElement.outerHTML;
|
html = document.toString();
|
||||||
html = html.replace(/{{domain}}/g, domainUtils.toOssDomain(domain) + '/');
|
html = html.replace(/{{domain}}/g, domainUtils.toOssDomain(domain) + '/');
|
||||||
|
|
||||||
return `<!DOCTYPE html>
|
return `<!DOCTYPE html>
|
||||||
|
|||||||
Reference in New Issue
Block a user