summaryrefslogtreecommitdiff
path: root/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/documentwidget.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 4a4101b1..f0ee9823 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1135,7 +1135,18 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode
1135 useBanner = iFalse; /* valid data wasn't received from host */ 1135 useBanner = iFalse; /* valid data wasn't received from host */
1136 appendFormat_String(src, "\n\n>%s\n", cstr_String(meta)); 1136 appendFormat_String(src, "\n\n>%s\n", cstr_String(meta));
1137 break; 1137 break;
1138 /* fall through */ 1138 case tlsServerCertificateExpired_GmStatusCode:
1139 makeFooterButtons_DocumentWidget_(
1140 d,
1141 (iMenuItem[]){ { rightArrowhead_Icon " Ignore Expiry and Continue Loading",
1142 0, 0, "server.unexpire"
1143 },
1144 { info_Icon " ${menu.pageinfo}",
1145 SDLK_i,
1146 KMOD_PRIMARY,
1147 "document.info" } },
1148 2);
1149 break;
1139 case tlsServerCertificateNotVerified_GmStatusCode: 1150 case tlsServerCertificateNotVerified_GmStatusCode:
1140 makeFooterButtons_DocumentWidget_( 1151 makeFooterButtons_DocumentWidget_(
1141 d, 1152 d,
@@ -1575,12 +1586,12 @@ static void updateTrust_DocumentWidget_(iDocumentWidget *d, const iGmResponse *r
1575 ~d->certFlags & trusted_GmCertFlag) { 1586 ~d->certFlags & trusted_GmCertFlag) {
1576 updateTextCStr_LabelWidget(lock, red_ColorEscape warning_Icon); 1587 updateTextCStr_LabelWidget(lock, red_ColorEscape warning_Icon);
1577 } 1588 }
1578 else if (d->certFlags & trusted_GmCertFlag) { 1589 else if (~d->certFlags & timeVerified_GmCertFlag) {
1579 updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_Icon); 1590 updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape warning_Icon
1591 : black_ColorEscape warning_Icon);
1580 } 1592 }
1581 else { 1593 else {
1582 updateTextCStr_LabelWidget(lock, isDarkMode ? orange_ColorEscape warning_Icon 1594 updateTextCStr_LabelWidget(lock, green_ColorEscape closedLock_Icon);
1583 : black_ColorEscape warning_Icon);
1584 } 1595 }
1585 setBanner_GmDocument(d->doc, bannerType_DocumentWidget_(d)); 1596 setBanner_GmDocument(d->doc, bannerType_DocumentWidget_(d));
1586} 1597}
@@ -2631,12 +2642,27 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd)
2631 addAction_Widget(dlg, SDLK_SPACE, 0, "message.ok"); 2642 addAction_Widget(dlg, SDLK_SPACE, 0, "message.ok");
2632 return iTrue; 2643 return iTrue;
2633 } 2644 }
2645 else if (equal_Command(cmd, "server.unexpire") && document_App() == d) {
2646 const iRangecc host = urlHost_String(d->mod.url);
2647 const uint16_t port = urlPort_String(d->mod.url);
2648 if (!isEmpty_Block(d->certFingerprint) && !isEmpty_Range(&host)) {
2649 iTime expiry;
2650 initCurrent_Time(&expiry);
2651 iTime oneHour; /* One hour is long enough for a single visit (?). */
2652 initSeconds_Time(&oneHour, 3600);
2653 add_Time(&expiry, &oneHour);
2654 iDate expDate;
2655 init_Date(&expDate, &expiry);
2656 setTrusted_GmCerts(certs_App(), host, port, d->certFingerprint, &expDate);
2657 postCommand_Widget(w, "navigate.reload");
2658 }
2659 return iTrue;
2660 }
2634 else if (equal_Command(cmd, "server.trustcert") && document_App() == d) { 2661 else if (equal_Command(cmd, "server.trustcert") && document_App() == d) {
2635 const iRangecc host = urlHost_String(d->mod.url); 2662 const iRangecc host = urlHost_String(d->mod.url);
2636 const uint16_t port = urlPort_String(d->mod.url); 2663 const uint16_t port = urlPort_String(d->mod.url);
2637 if (!isEmpty_Block(d->certFingerprint) && !isEmpty_Range(&host)) { 2664 if (!isEmpty_Block(d->certFingerprint) && !isEmpty_Range(&host)) {
2638 setTrusted_GmCerts(certs_App(), host, port, d->certFingerprint, &d->certExpiry); 2665 setTrusted_GmCerts(certs_App(), host, port, d->certFingerprint, &d->certExpiry);
2639 d->certFlags |= trusted_GmCertFlag;
2640 postCommand_Widget(w, "navigate.reload"); 2666 postCommand_Widget(w, "navigate.reload");
2641 } 2667 }
2642 return iTrue; 2668 return iTrue;