Skip to content

Commit 9b1c0e7

Browse files
committed
add a banner in trial mode
1 parent 18dfeaa commit 9b1c0e7

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Alert } from "antd";
2+
import { A } from "@cocalc/frontend/components/A";
3+
4+
export default function InsecureTestModeBanner() {
5+
return (
6+
<Alert
7+
banner
8+
type="warning"
9+
showIcon
10+
style={{ background: "darkred", color: "white" }}
11+
message={
12+
<div style={{ textAlign: "center" }}>
13+
<A
14+
href="https://cocalc.com/pricing/onprem"
15+
style={{ color: "white" }}
16+
>
17+
<b>WARNING:</b> This is CoCalc OnPrem running in{" "}
18+
<b>A HIGHLY INSECURE TRIAL MODE</b>.
19+
</A>
20+
</div>
21+
}
22+
/>
23+
);
24+
}

src/packages/frontend/app/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { HIDE_LABEL_THRESHOLD, NAV_CLASS } from "./top-nav-consts";
4545
import { CookieWarning, LocalStorageWarning, VersionWarning } from "./warnings";
4646
import { I18NBanner, useShowI18NBanner } from "./i18n-banner";
4747
import SettingsModal from "./settings-modal";
48+
import InsecureTestModeBanner from "./insecure-test-mode-banner";
4849

4950
// ipad and ios have a weird trick where they make the screen
5051
// actually smaller than 100vh and have it be scrollable, even
@@ -113,6 +114,7 @@ export const Page: React.FC = () => {
113114
const show_i18n = useShowI18NBanner();
114115

115116
const is_commercial = useTypedRedux("customize", "is_commercial");
117+
const insecure_test_mode = useTypedRedux("customize", "insecure_test_mode");
116118

117119
function account_tab_icon(): IconName | JSX.Element {
118120
if (is_anonymous) {
@@ -371,6 +373,7 @@ export const Page: React.FC = () => {
371373
onDragOver={(e) => e.preventDefault()}
372374
onDrop={drop}
373375
>
376+
{insecure_test_mode && <InsecureTestModeBanner />}
374377
{show_file_use && (
375378
<div style={fileUseStyle} className="smc-vfill">
376379
<FileUsePage />

src/packages/frontend/customize.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,8 @@ export interface CustomizeState {
177177
default_llm?: string;
178178
user_defined_llm: boolean;
179179

180+
insecure_test_mode?: boolean;
181+
180182
i18n?: List<Locale>;
181183
}
182184

@@ -329,7 +331,7 @@ function process_customize(obj) {
329331
for (const k in site_settings_conf) {
330332
const v = site_settings_conf[k];
331333
obj[k] =
332-
obj[k] != null ? obj[k] : v.to_val?.(v.default, obj_orig) ?? v.default;
334+
obj[k] != null ? obj[k] : (v.to_val?.(v.default, obj_orig) ?? v.default);
333335
}
334336
// the llm markup special case
335337
obj.llm_markup = obj_orig._llm_markup ?? 30;

0 commit comments

Comments
 (0)