@secrecy/lib 1.41.0-feat-remove-me-domain.3 → 1.41.0-feat-remove-me-domain.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,11 +19,12 @@ export function parseInfos() {
19
19
  }
20
20
  export const getUrl = ({ hash, path, }) => {
21
21
  const lang = document.documentElement.lang;
22
- const authUrl = process.env.NEXT_PUBLIC_VERCEL_URL
23
- ? `${process.env.NEXT_PUBLIC_VERCEL_URL}${lang}/auth`
24
- : `https://auth.secrecy.tech/${lang}`;
22
+ const protocol = process.env.NEXT_PUBLIC_VERCEL_ENV !== 'development' ? 'https' : 'http';
23
+ const url = process.env.NEXT_PUBLIC_VERCEL_ENV !== 'production'
24
+ ? `${process.env.NEXT_PUBLIC_VERCEL_URL}/${lang}/auth`
25
+ : `auth.secrecy.tech/${lang}`;
25
26
  path = path.startsWith('/') ? path : `/${path}`;
26
- return `${authUrl}${path}#${hash}`;
27
+ return `${protocol}://${url}${path}#${hash}`;
27
28
  };
28
29
  export function getSecrecyClient(session) {
29
30
  const storage = getStorage(session);
@@ -9,6 +9,13 @@ superjson.registerCustom({
9
9
  serialize: (v) => [...v],
10
10
  deserialize: (v) => Buffer.from(v),
11
11
  }, 'buffer');
12
+ export const getUrl = () => {
13
+ const protocol = process.env.NEXT_PUBLIC_VERCEL_ENV !== 'development' ? 'https' : 'http';
14
+ const url = process.env.NEXT_PUBLIC_VERCEL_ENV !== 'production'
15
+ ? `${process.env.NEXT_PUBLIC_VERCEL_URL}/api/trpc`
16
+ : `api.secrecy.tech/trpc`;
17
+ return `${protocol}://${url}`;
18
+ };
12
19
  export const createTRPCClient = (session, onAccessDenied) => createTRPCProxyClient({
13
20
  transformer: superjson,
14
21
  links: [
@@ -24,8 +31,7 @@ export const createTRPCClient = (session, onAccessDenied) => createTRPCProxyClie
24
31
  },
25
32
  }),
26
33
  httpBatchLink({
27
- url: process.env.NEXT_PUBLIC_SECRECY_API_URL ??
28
- 'https://api.secrecy.tech/',
34
+ url: getUrl(),
29
35
  maxURLLength: 2083,
30
36
  fetch: async (input, init) => {
31
37
  const controller = new AbortController();
@@ -5,6 +5,7 @@ import superjson from 'superjson';
5
5
  export type RouterInputs = inferRouterInputs<AppRouter>;
6
6
  export type RouterOutputs = inferRouterOutputs<AppRouter>;
7
7
  export declare function isTRPCClientError(cause: unknown): cause is TRPCClientError<AppRouter>;
8
+ export declare const getUrl: () => string;
8
9
  export declare const createTRPCClient: (session?: string | null | undefined, onAccessDenied?: () => void | Promise<void>) => {
9
10
  account: {
10
11
  createUser: {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@secrecy/lib",
3
3
  "author": "Anonymize <anonymize@gmail.com>",
4
4
  "description": "Anonymize Secrecy Library",
5
- "version": "1.41.0-feat-remove-me-domain.3",
5
+ "version": "1.41.0-feat-remove-me-domain.5",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/anonymize-org/lib.git"
@@ -88,6 +88,5 @@
88
88
  "spark-md5": "^3.0.2",
89
89
  "superjson": "2.2.1",
90
90
  "zod": "3.23.8"
91
- },
92
- "packageManager": "pnpm@7.33.7+sha512.7afe2410642b39c698df46da4ce5c7231a5cce360698d69f8cf8f42257d40b3e43f231053b07b8de849fd4ffbf4a71ff57b835137777a352388f3d3da747200e"
91
+ }
93
92
  }