Skip to content

Commit 21f1326

Browse files
authored
Merge pull request #651 from fosrl/dev
Dev
2 parents 5d2f318 + f62e327 commit 21f1326

File tree

10 files changed

+40
-54
lines changed

10 files changed

+40
-54
lines changed

server/lib/ip.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function detectIpVersion(ip: string): IPVersion {
1717
*/
1818
function ipToBigInt(ip: string): bigint {
1919
const version = detectIpVersion(ip);
20-
20+
2121
if (version === 4) {
2222
return ip.split('.')
2323
.reduce((acc, octet) => {
@@ -105,7 +105,7 @@ export function cidrToRange(cidr: string): IPRange {
105105
const version = detectIpVersion(ip);
106106
const prefixBits = parseInt(prefix);
107107
const ipBigInt = ipToBigInt(ip);
108-
108+
109109
// Validate prefix length
110110
const maxPrefix = version === 4 ? 32 : 128;
111111
if (prefixBits < 0 || prefixBits > maxPrefix) {
@@ -116,7 +116,7 @@ export function cidrToRange(cidr: string): IPRange {
116116
const mask = BigInt.asUintN(version === 4 ? 64 : 128, (BigInt(1) << shiftBits) - BigInt(1));
117117
const start = ipBigInt & ~mask;
118118
const end = start | mask;
119-
119+
120120
return { start, end };
121121
}
122122

@@ -136,17 +136,17 @@ export function findNextAvailableCidr(
136136
if (!startCidr && existingCidrs.length === 0) {
137137
return null;
138138
}
139-
139+
140140
// If no existing CIDRs, use the IP version from startCidr
141-
const version = startCidr
141+
const version = startCidr
142142
? detectIpVersion(startCidr.split('/')[0])
143143
: 4; // Default to IPv4 if no startCidr provided
144-
144+
145145
// Use appropriate default startCidr if none provided
146146
startCidr = startCidr || (version === 4 ? "0.0.0.0/0" : "::/0");
147-
147+
148148
// If there are existing CIDRs, ensure all are same version
149-
if (existingCidrs.length > 0 &&
149+
if (existingCidrs.length > 0 &&
150150
existingCidrs.some(cidr => detectIpVersion(cidr.split('/')[0]) !== version)) {
151151
throw new Error('All CIDRs must be of the same IP version');
152152
}
@@ -196,12 +196,14 @@ export function findNextAvailableCidr(
196196
export function isIpInCidr(ip: string, cidr: string): boolean {
197197
const ipVersion = detectIpVersion(ip);
198198
const cidrVersion = detectIpVersion(cidr.split('/')[0]);
199-
199+
200+
// If IP versions don't match, the IP cannot be in the CIDR range
200201
if (ipVersion !== cidrVersion) {
201-
throw new Error('IP address and CIDR must be of the same version');
202+
// throw new Erorr
203+
return false;
202204
}
203205

204206
const ipBigInt = ipToBigInt(ip);
205207
const range = cidrToRange(cidr);
206208
return ipBigInt >= range.start && ipBigInt <= range.end;
207-
}
209+
}

server/routers/idp/generateOidcUrl.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const bodySchema = z
2828
.strict();
2929

3030
const ensureTrailingSlash = (url: string): string => {
31-
return url.endsWith('/') ? url : `${url}/`;
31+
return url;
3232
};
3333

3434
export type GenerateOidcUrlResponse = {

server/routers/idp/validateOidcCallback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { oidcAutoProvision } from "./oidcAutoProvision";
2323
import license from "@server/license/license";
2424

2525
const ensureTrailingSlash = (url: string): string => {
26-
return url.endsWith("/") ? url : `${url}/`;
26+
return url;
2727
};
2828

2929
const paramsSchema = z
@@ -243,7 +243,7 @@ export async function validateOidcCallback(
243243
return next(
244244
createHttpError(
245245
HttpCode.UNAUTHORIZED,
246-
"User not provisioned in the system"
246+
`User with username ${userIdentifier} is unprovisioned. This user must be added to an organization before logging in.`
247247
)
248248
);
249249
}

src/app/[orgId]/settings/resources/[resourceId]/proxy/page.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,12 @@ export default function ReverseProxyTargets(props: {
363363
setHttpsTlsLoading(true);
364364
await api.post(`/resource/${params.resourceId}`, {
365365
ssl: data.ssl,
366-
tlsServerName: data.tlsServerName || undefined
366+
tlsServerName: data.tlsServerName || null
367367
});
368368
updateResource({
369369
...resource,
370370
ssl: data.ssl,
371-
tlsServerName: data.tlsServerName || undefined
371+
tlsServerName: data.tlsServerName || null
372372
});
373373
toast({
374374
title: "TLS settings updated",
@@ -393,11 +393,11 @@ export default function ReverseProxyTargets(props: {
393393
try {
394394
setProxySettingsLoading(true);
395395
await api.post(`/resource/${params.resourceId}`, {
396-
setHostHeader: data.setHostHeader || undefined
396+
setHostHeader: data.setHostHeader || null
397397
});
398398
updateResource({
399399
...resource,
400-
setHostHeader: data.setHostHeader || undefined
400+
setHostHeader: data.setHostHeader || null
401401
});
402402
toast({
403403
title: "Proxy settings updated",

src/app/[orgId]/settings/resources/create/page.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,15 @@ export default function Page() {
173173
if (httpData.isBaseDomain) {
174174
Object.assign(payload, {
175175
domainId: httpData.domainId,
176-
isBaseDomain: true
176+
isBaseDomain: true,
177+
protocol: "tcp"
177178
});
178179
} else {
179180
Object.assign(payload, {
180181
subdomain: httpData.subdomain,
181182
domainId: httpData.domainId,
182-
isBaseDomain: false
183+
isBaseDomain: false,
184+
protocol: "tcp"
183185
});
184186
}
185187
} else {

src/app/admin/license/components/SitePriceCalculator.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ export function SitePriceCalculator({
137137
</div>
138138

139139
<p className="text-muted-foreground text-sm mt-2 text-center">
140-
For the most up-to-date pricing, please visit
141-
our{" "}
140+
For the most up-to-date pricing and discounts,
141+
please visit the{" "}
142142
<a
143143
href="https://docs.fossorial.io/pricing"
144144
target="_blank"

src/app/admin/license/page.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@ export default function LicensePage() {
452452
in system
453453
</div>
454454
</div>
455+
{!licenseStatus?.isHostLicensed && (
456+
<p className="text-sm text-muted-foreground">
457+
There is no limit on the number of sites
458+
using an unlicensed host.
459+
</p>
460+
)}
455461
{licenseStatus?.maxSites && (
456462
<div className="space-y-2">
457463
<div className="flex justify-between text-sm">

src/components/Breadcrumbs.tsx

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,33 +16,7 @@ export function Breadcrumbs() {
1616

1717
const breadcrumbs: BreadcrumbItem[] = segments.map((segment, index) => {
1818
const href = `/${segments.slice(0, index + 1).join("/")}`;
19-
let label = segment;
20-
21-
// // Format labels
22-
// if (segment === "settings") {
23-
// label = "Settings";
24-
// } else if (segment === "sites") {
25-
// label = "Sites";
26-
// } else if (segment === "resources") {
27-
// label = "Resources";
28-
// } else if (segment === "access") {
29-
// label = "Access Control";
30-
// } else if (segment === "general") {
31-
// label = "General";
32-
// } else if (segment === "share-links") {
33-
// label = "Shareable Links";
34-
// } else if (segment === "users") {
35-
// label = "Users";
36-
// } else if (segment === "roles") {
37-
// label = "Roles";
38-
// } else if (segment === "invitations") {
39-
// label = "Invitations";
40-
// } else if (segment === "proxy") {
41-
// label = "proxy";
42-
// } else if (segment === "authentication") {
43-
// label = "Authentication";
44-
// }
45-
19+
let label = decodeURIComponent(segment);
4620
return { label, href };
4721
});
4822

src/components/SupporterStatus.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,12 @@ export default function SupporterStatus() {
189189
<CredenzaBody>
190190
<p>
191191
Purchase a supporter key to help us continue
192-
developing Pangolin. Your contribution allows us
193-
commit more time to maintain and add new features to
194-
the application for everyone. We will never use this
195-
to paywall features.
192+
developing Pangolin for the community. Your
193+
contribution allows us to commit more time to
194+
maintain and add new features to the application for
195+
everyone. We will never use this to paywall
196+
features. This is separate from the Professional
197+
Edition.
196198
</p>
197199

198200
<p>

src/components/ui/toast.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const ToastViewport = React.forwardRef<
1616
<ToastPrimitives.Viewport
1717
ref={ref}
1818
className={cn(
19-
"fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",
19+
"fixed top-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 md:max-w-[420px]",
2020
className
2121
)}
2222
{...props}

0 commit comments

Comments
 (0)