Skip to content

armgit / fider

Public Imported from GitHub
0

Open platform to collect and prioritize feedback

feature: add billing menu item (#701)

Guilherme Oenninge8cdfc4a0cb9
diff --git a/app/cmd/routes.go b/app/cmd/routes.go
index e46a39f12..c4cf5b3b7 100644
--- a/app/cmd/routes.go
+++ b/app/cmd/routes.go
@@ -147,6 +147,7 @@ func routes(r *web.Engine) *web.Engine {
//From this step, only Administrators are allowed
ui.Use(middlewares.IsAuthorized(models.RoleAdministrator))
+ ui.Get("/admin/billing", handlers.BillingPage())
ui.Get("/admin/export", handlers.Page("Export · Site Settings", "", "Export.page"))
ui.Get("/admin/export/posts.csv", handlers.ExportPostsToCSV())
ui.Post("/_api/admin/settings/general", handlers.UpdateSettings())
diff --git a/app/handlers/billing.go b/app/handlers/billing.go
new file mode 100644
index 000000000..1affe0762
--- /dev/null
+++ b/app/handlers/billing.go
@@ -0,0 +1,20 @@
+package handlers
+
+import (
+ "github.com/getfider/fider/app/pkg/env"
+ "github.com/getfider/fider/app/pkg/web"
+)
+
+// BillingPage is the billing settings page
+func BillingPage() web.HandlerFunc {
+ return func(c web.Context) error {
+ if !env.IsBillingEnabled() {
+ return c.Redirect(c.BaseURL())
+ }
+
+ return c.Page(web.Props{
+ Title: "Billing · Site Settings",
+ ChunkName: "Billing.page",
+ })
+ }
+}
diff --git a/app/middlewares/user.go b/app/middlewares/user.go
index 98ab16424..dfc767011 100644
--- a/app/middlewares/user.go
+++ b/app/middlewares/user.go
@@ -13,7 +13,7 @@ import (
"github.com/getfider/fider/app/pkg/errors"
"github.com/getfider/fider/app/pkg/jwt"
"github.com/getfider/fider/app/pkg/web"
- "github.com/getfider/fider/app/pkg/web/util"
+ webutil "github.com/getfider/fider/app/pkg/web/util"
)
// User gets JWT Auth token from cookie and insert into context
@@ -89,6 +89,13 @@ func User() web.MiddlewareFunc {
if user != nil && c.Tenant() != nil && user.Tenant.ID == c.Tenant().ID {
+ // only administrators should be allowed to sign in to a locked tenant
+ if c.Tenant().Status == models.TenantLocked && !user.IsAdministrator() {
+ c.RemoveCookie(web.CookieAuthName)
+ return c.Unauthorized()
+ }
+
+ // blocked users are unable to sign in
if user.Status == models.UserBlocked {
c.RemoveCookie(web.CookieAuthName)
return c.Unauthorized()
diff --git a/app/middlewares/user_test.go b/app/middlewares/user_test.go
index 0bec648d2..1032f9839 100644
--- a/app/middlewares/user_test.go
+++ b/app/middlewares/user_test.go
@@ -76,6 +76,51 @@ func TestUser_Blocked(t *testing.T) {
Expect(status).Equals(http.StatusForbidden)
}
+func TestUser_LockedTenant_Administrator(t *testing.T) {
+ RegisterT(t)
+
+ server, _ := mock.NewServer()
+ mock.DemoTenant.Status = models.TenantLocked
+ token, _ := jwt.Encode(jwt.FiderClaims{
+ UserID: mock.JonSnow.ID,
+ UserName: mock.JonSnow.Name,
+ })
+
+ server.Use(middlewares.User())
+ status, response := server.
+ OnTenant(mock.DemoTenant).
+ AddHeader("Accept", "application/json").
+ AddCookie(web.CookieAuthName, token).
+ Execute(func(c web.Context) error {
+ return c.String(http.StatusOK, c.User().Name)
+ })
+
+ Expect(status).Equals(http.StatusOK)
+ Expect(response.Body.String()).Equals("Jon Snow")
+}
+
+func TestUser_LockedTenant_Visitor(t *testing.T) {
+ RegisterT(t)
+
+ server, _ := mock.NewServer()
+ mock.DemoTenant.Status = models.TenantLocked
+ token, _ := jwt.Encode(jwt.FiderClaims{
+ UserID: mock.AryaStark.ID,
+ UserName: mock.AryaStark.Name,
+ })
+
+ server.Use(middlewares.User())
+ status, _ := server.
+ OnTenant(mock.DemoTenant).
+ AddHeader("Accept", "application/json").
+ AddCookie(web.CookieAuthName, token).
+ Execute(func(c web.Context) error {
+ return c.String(http.StatusOK, c.User().Name)
+ })
+
+ Expect(status).Equals(http.StatusForbidden)
+}
+
func TestUser_WithCookie_InvalidUser(t *testing.T) {
RegisterT(t)
diff --git a/app/pkg/env/env.go b/app/pkg/env/env.go
index 1b10bb5d9..d4c2c454a 100644
--- a/app/pkg/env/env.go
+++ b/app/pkg/env/env.go
@@ -25,6 +25,10 @@ type config struct {
MaxIdleConns int `env:"DATABASE_MAX_IDLE_CONNS,default=2,strict"`
MaxOpenConns int `env:"DATABASE_MAX_OPEN_CONNS,default=4,strict"`
}
+ Stripe struct {
+ SecretKey string `env:"STRIPE_SECRET_KEY"`
+ PublicKey string `env:"STRIPE_PUBLIC_KEY"`
+ }
CDN struct {
Host string `env:"CDN_HOST"`
}
@@ -123,6 +127,11 @@ func mustBeSet(name string) {
}
}
+// IsBillingEnabled returns true if billing is enabled
+func IsBillingEnabled() bool {
+ return Config.Stripe.SecretKey != "" && Config.Stripe.PublicKey != ""
+}
+
// IsSingleHostMode returns true if host mode is set to single tenant
func IsSingleHostMode() bool {
return Config.HostMode == "single"
diff --git a/app/pkg/env/env_test.go b/app/pkg/env/env_test.go
index 1eb7ec7b5..fb69af3df 100644
--- a/app/pkg/env/env_test.go
+++ b/app/pkg/env/env_test.go
@@ -67,6 +67,16 @@ func TestMultiTenantDomain(t *testing.T) {
Expect(env.MultiTenantDomain()).Equals(".fider.io")
}
+func TestIsBillingEnbled(t *testing.T) {
+ RegisterT(t)
+
+ env.Config.Stripe.SecretKey = ""
+ env.Config.Stripe.PublicKey = "pk_111"
+ Expect(env.IsBillingEnabled()).IsFalse()
+ env.Config.Stripe.SecretKey = "sk_1234"
+ Expect(env.IsBillingEnabled()).IsTrue()
+}
+
func TestSubdomain(t *testing.T) {
RegisterT(t)
diff --git a/app/pkg/web/renderer.go b/app/pkg/web/renderer.go
index 1092754e2..137d78f0a 100644
--- a/app/pkg/web/renderer.go
+++ b/app/pkg/web/renderer.go
@@ -210,6 +210,7 @@ func (r *Renderer) Render(w io.Writer, name string, props Props, ctx *Context) {
"environment": r.settings.Environment,
"compiler": r.settings.Compiler,
"googleAnalytics": r.settings.GoogleAnalytics,
+ "stripePublicKey": env.Config.Stripe.PublicKey,
"domain": r.settings.Domain,
"hasLegal": r.settings.HasLegal,
"baseURL": ctx.BaseURL(),
diff --git a/app/pkg/web/testdata/basic.html b/app/pkg/web/testdata/basic.html
index 12d96431b..4f1619b6c 100755
--- a/app/pkg/web/testdata/basic.html
+++ b/app/pkg/web/testdata/basic.html
@@ -38,7 +38,7 @@
<script id="server-data" type="application/json">
- {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"Fider"}
+ {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"Fider"}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch" crossorigin="anonymous"></script>
diff --git a/app/pkg/web/testdata/canonical.html b/app/pkg/web/testdata/canonical.html
index cb9ba5ff8..3e38c18a3 100755
--- a/app/pkg/web/testdata/canonical.html
+++ b/app/pkg/web/testdata/canonical.html
@@ -40,7 +40,7 @@
<script id="server-data" type="application/json">
- {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__canonicalURL":"http://feedback.demo.org","__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"Fider"}
+ {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__canonicalURL":"http://feedback.demo.org","__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"Fider"}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch" crossorigin="anonymous"></script>
diff --git a/app/pkg/web/testdata/chunk.html b/app/pkg/web/testdata/chunk.html
index a99ee7f0c..6ddd3b0a2 100644
--- a/app/pkg/web/testdata/chunk.html
+++ b/app/pkg/web/testdata/chunk.html
@@ -45,7 +45,7 @@
<script id="server-data" type="application/json">
- {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__chunkAssets":{"CSS":["/assets/css/Test.page.css"],"JS":["/assets/js/Test.page.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"Fider"}
+ {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__chunkAssets":{"CSS":["/assets/css/Test.page.css"],"JS":["/assets/js/Test.page.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"Fider"}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch" crossorigin="anonymous"></script>
diff --git a/app/pkg/web/testdata/props.html b/app/pkg/web/testdata/props.html
index fb3a7ec8f..fc01ae669 100755
--- a/app/pkg/web/testdata/props.html
+++ b/app/pkg/web/testdata/props.html
@@ -38,7 +38,7 @@
<script id="server-data" type="application/json">
- {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__description":"My Page Description","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":{"array":["1","2"],"number":2,"object":{"key1":"value1","key2":"value2"}},"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"My Page Title · Fider"}
+ {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__description":"My Page Description","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":{"array":["1","2"],"number":2,"object":{"key1":"value1","key2":"value2"}},"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"My Page Title · Fider"}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch" crossorigin="anonymous"></script>
diff --git a/app/pkg/web/testdata/tenant.html b/app/pkg/web/testdata/tenant.html
index 86bb48ee6..dda074327 100755
--- a/app/pkg/web/testdata/tenant.html
+++ b/app/pkg/web/testdata/tenant.html
@@ -40,7 +40,7 @@
<script id="server-data" type="application/json">
- {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","isPrivate":false,"logoBlobKey":""},"__title":"Game of Thrones"}
+ {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","isPrivate":false,"logoBlobKey":""},"__title":"Game of Thrones"}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch" crossorigin="anonymous"></script>
diff --git a/app/pkg/web/testdata/user.html b/app/pkg/web/testdata/user.html
index 1ec8c5ac4..afb4de2d4 100755
--- a/app/pkg/web/testdata/user.html
+++ b/app/pkg/web/testdata/user.html
@@ -38,7 +38,7 @@
<script id="server-data" type="application/json">
- {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__description":"My Page Description","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"My Page Title · Fider","__user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}
+ {"__assets":{"CSS":["/assets/css/file1.css"],"JS":["/assets/js/file1.js","/assets/js/file2.js"]},"__contextID":"CONTEXT_ID","__currentURL":"https://demo.test.fider.io:3000/","__description":"My Page Description","__favicon":"https://demo.test.fider.io:3000/favicon","__logo":"https://getfider.com/images/logo-100x100.png","__props":null,"__settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"stripePublicKey":"","tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"__tenant":null,"__title":"My Page Title · Fider","__user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"[email protected]","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}
</script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=default,fetch" crossorigin="anonymous"></script>
diff --git a/public/AsyncPages.tsx b/public/AsyncPages.tsx
index 0a5ee6e02..481c4b3b0 100644
--- a/public/AsyncPages.tsx
+++ b/public/AsyncPages.tsx
@@ -98,6 +98,11 @@ export const AsyncMySettingsPage = load(() =>
"@fider/pages/MySettings/MySettings.page")
);
+export const AsyncBillingPage = load(() =>
+ import(/* webpackChunkName: "Billing.page" */
+ "@fider/pages/Administration/pages/Billing.page")
+);
+
export const AsyncOAuthEchoPage = load(() =>
import(/* webpackChunkName: "OAuthEcho.page" */
"@fider/pages/OAuthEcho/OAuthEcho.page")
diff --git a/public/components/common/FiderVersion.tsx b/public/components/common/FiderVersion.tsx
index 2d468e4fb..28f14b8a6 100644
--- a/public/components/common/FiderVersion.tsx
+++ b/public/components/common/FiderVersion.tsx
@@ -4,11 +4,15 @@ import { Fider } from "@fider/services";
export const FiderVersion = () => {
return (
<p className="info center hidden-sm hidden-md">
- Support our{" "}
- <a target="_blank" href="http://opencollective.com/fider">
- OpenCollective
- </a>
- <br />
+ {!Fider.isBillingEnabled() && (
+ <>
+ Support our{" "}
+ <a target="_blank" href="http://opencollective.com/fider">
+ OpenCollective
+ </a>
+ <br />
+ </>
+ )}
Fider v{Fider.settings.version}
</p>
);
diff --git a/public/models/settings.ts b/public/models/settings.ts
index 176e645ce..a1289b87d 100644
--- a/public/models/settings.ts
+++ b/public/models/settings.ts
@@ -18,6 +18,7 @@ export interface SystemSettings {
domain: string;
hasLegal: boolean;
baseURL: string;
+ stripePublicKey?: string;
tenantAssetsURL: string;
globalAssetsURL: string;
oauth: OAuthProviderOption[];
diff --git a/public/pages/Administration/components/SideMenu.tsx b/public/pages/Administration/components/SideMenu.tsx
index f281fe94b..149107446 100644
--- a/public/pages/Administration/components/SideMenu.tsx
+++ b/public/pages/Administration/components/SideMenu.tsx
@@ -63,7 +63,12 @@ export const SideMenu = (props: SiteMenuProps) => {
/>
<SideMenuItem name="advanced" title="Advanced" href="/admin/advanced" isActive={activeItem === "advanced"} />
{Fider.session.user.isAdministrator && (
- <SideMenuItem name="export" title="Export" href="/admin/export" isActive={activeItem === "export"} />
+ <>
+ {Fider.isBillingEnabled() && (
+ <SideMenuItem name="billing" title="Billing" href="/admin/billing" isActive={activeItem === "billing"} />
+ )}
+ <SideMenuItem name="export" title="Export" href="/admin/export" isActive={activeItem === "export"} />
+ </>
)}
</div>
<FiderVersion />
diff --git a/public/pages/Administration/pages/Billing.page.tsx b/public/pages/Administration/pages/Billing.page.tsx
new file mode 100644
index 000000000..37ae5eb7c
--- /dev/null
+++ b/public/pages/Administration/pages/Billing.page.tsx
@@ -0,0 +1,16 @@
+import React from "react";
+
+import { FaFileInvoice } from "react-icons/fa";
+import { AdminBasePage } from "../components/AdminBasePage";
+
+export default class BillingPage extends AdminBasePage<{}, {}> {
+ public id = "p-admin-billing";
+ public name = "billing";
+ public icon = FaFileInvoice;
+ public title = "Billing";
+ public subtitle = "Manage your subscription";
+
+ public content() {
+ return <h4>Work in progress</h4>;
+ }
+}
diff --git a/public/router.tsx b/public/router.tsx
index 36a375e54..b7e8b44e2 100644
--- a/public/router.tsx
+++ b/public/router.tsx
@@ -23,6 +23,7 @@ const pathRegex = [
route("/admin/members", Pages.AsyncManageMembersPage),
route("/admin/tags", Pages.AsyncManageTagsPage),
route("/admin/privacy", Pages.AsyncPrivacySettingsPage),
+ route("/admin/billing", Pages.AsyncBillingPage),
route("/admin/export", Pages.AsyncExportPage),
route("/admin/invitations", Pages.AsyncInvitationsPage),
route("/admin/authentication", Pages.AsyncManageAuthenticationPage),
diff --git a/public/services/fider.ts b/public/services/fider.ts
index ff818c074..c4c6dc9fd 100644
--- a/public/services/fider.ts
+++ b/public/services/fider.ts
@@ -54,6 +54,10 @@ export class FiderImpl {
return this.pSettings;
}
+ public isBillingEnabled(): boolean {
+ return !!this.pSettings.stripePublicKey;
+ }
+
public isProduction(): boolean {
return this.pSettings.environment === "production";
}