這邊記錄一下我在 spring-boot 中,處理 CSP 的 CSP report 遇到的坑
2024-08-28
2024-08-16
以數字開頭的 class element
如果 HTML code 如下
<span>Hello</span>
<span class="123">John Smith</span>
而 CSS 寫成如下,是無法作用的
.123{
font-weight: bold;
color: CornflowerBlue;
}
2024-08-12
2024-07-29
2024-07-19
OAuth 2.0 的 PKCE 筆記
PKCE 詳細規格請參閱 RFC7636
我在撰寫 OAuth 2.0 的登入時,會遇到 code_verifier
和 code_challenge
一直對不起來的狀況。
舉例來說,我請求 token 的參數為
client_id=aaa&
client_secret=bbb&
code=thisisasimpletoken&
code_verifier=HelloWorld&
grant_type=authorization_code
按照規範,我取得 authorization code 的 request 應該是
client_id=aaa&
response_type=code&
scope=User.Read.All&
response_mode=form_post&
code_challenge_method=S256&
code_challenge=<將“HelloWorld”以 S256 加密後的字串>
2024-07-03
2024-06-19
2024-06-07
SVG 文字置中
首先是個普通的 SVG:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 200 200" width="300">
<g fill="none" stroke="rgba(22, 22, 22, 0.5)">
<path d="M 90 90 L 110 110 Z"/>
<path d="M 110 90 L 90 110 Z"/>
</g>
<text font-family="Arial, sans-serif" x="100" y="100" font-size="30">Hi! quick fox</text>
</svg>
為了方便辨識,在 (100, 100) 的位置打了個叉。
上面的 SVG 可以看出來,文字無論是 x 軸還是 y 軸都沒有置中。
2024-05-29
Microsoft Email SMTP 設定
不知為何還蠻難找到 MS 365 的 SMTP 設定,在此紀錄
host | outlook-apaccentral.office365.com |
---|---|
port | 587 |
protocol | smtp |
username | 你的 Outlook mail,例如 john.smith@live.com |
password | Outlook 密碼 |
from | 同 username |
另外,我是使用 Java + spring, spring 有兩個參數不確定是在其他程式語言對應的數值,所以在這邊先列一下:
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.auth=true
2024-05-08
multipart Email 的 Content-Disposition 差異
如果我今天要寄一封 E-Mail,內文要有圖片,那整封信的內容可能如下:
Subject: This is a test mail!
From: test@example.com
Content-Type: multipart/mixed; boundary="qwertyuio"
--qwertyuio
Content-Type: text/html; name="example.html"
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Example</title>
</head>
<body>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
<img alt="" src="cid:28ce9652-4476-4e3c-8e9a-5d1bbae4cd05" />
</body>
</html>
--qwertyuio
Content-Type: image/jpeg; name="example.jpg"
Content-Disposition: attachment; filename="example.jpg"
Content-ID: 28ce9652-4476-4e3c-8e9a-5d1bbae4cd05
<image content>
--qwertyuio--
2024-05-03
SASS/SCSS處理 CSS 變數的問題
這是我使用他人套件時遇到的坑。
在使用 SASS / SCSS 時,遇到如下的 code
$red: #DB055E;
:root {
--red: $red
}
.danger {
color: var(--red)
}
我預期他應該會生成
:root {
--red: #DB055E;
}
.danger {
color: var(--red);
}
但實際上卻是生成
:root {
--red: $red;
}
.danger {
color: var(--red);
}
2024-03-11
訂閱:
文章 (Atom)