mirror of
https://github.com/foomo/gotrspc-mobile-examples.git
synced 2025-10-16 12:35:38 +00:00
feat: bootstrapped ios
This commit is contained in:
parent
9797215323
commit
8650c55cc4
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.*
|
||||
!.git*
|
||||
node_modules
|
||||
_next
|
||||
xcuserdata
|
||||
|
||||
|
||||
36
file-share/frontend/nextjs-file-share/.gitignore
vendored
Normal file
36
file-share/frontend/nextjs-file-share/.gitignore
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.js
|
||||
.yarn/install-state.gz
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# local env files
|
||||
.env*.local
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
36
file-share/frontend/nextjs-file-share/README.md
Normal file
36
file-share/frontend/nextjs-file-share/README.md
Normal file
@ -0,0 +1,36 @@
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
|
||||
|
||||
## Learn More
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
BIN
file-share/frontend/nextjs-file-share/app/favicon.ico
Normal file
BIN
file-share/frontend/nextjs-file-share/app/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
33
file-share/frontend/nextjs-file-share/app/globals.css
Normal file
33
file-share/frontend/nextjs-file-share/app/globals.css
Normal file
@ -0,0 +1,33 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
:root {
|
||||
--foreground-rgb: 0, 0, 0;
|
||||
--background-start-rgb: 214, 219, 220;
|
||||
--background-end-rgb: 255, 255, 255;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--foreground-rgb: 255, 255, 255;
|
||||
--background-start-rgb: 0, 0, 0;
|
||||
--background-end-rgb: 0, 0, 0;
|
||||
}
|
||||
}
|
||||
|
||||
body {
|
||||
color: rgb(var(--foreground-rgb));
|
||||
background: linear-gradient(
|
||||
to bottom,
|
||||
transparent,
|
||||
rgb(var(--background-end-rgb))
|
||||
)
|
||||
rgb(var(--background-start-rgb));
|
||||
}
|
||||
|
||||
@layer utilities {
|
||||
.text-balance {
|
||||
text-wrap: balance;
|
||||
}
|
||||
}
|
||||
22
file-share/frontend/nextjs-file-share/app/layout.tsx
Normal file
22
file-share/frontend/nextjs-file-share/app/layout.tsx
Normal file
@ -0,0 +1,22 @@
|
||||
import type { Metadata } from "next";
|
||||
import { Inter } from "next/font/google";
|
||||
import "./globals.css";
|
||||
|
||||
const inter = Inter({ subsets: ["latin"] });
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create Next App",
|
||||
description: "Generated by create next app",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
children,
|
||||
}: Readonly<{
|
||||
children: React.ReactNode;
|
||||
}>) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body className={inter.className}>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
113
file-share/frontend/nextjs-file-share/app/page.tsx
Normal file
113
file-share/frontend/nextjs-file-share/app/page.tsx
Normal file
@ -0,0 +1,113 @@
|
||||
import Image from "next/image";
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex min-h-screen flex-col items-center justify-between p-24">
|
||||
<div className="z-10 w-full max-w-5xl items-center justify-between font-mono text-sm lg:flex">
|
||||
<p className="fixed left-0 top-0 flex w-full justify-center border-b border-gray-300 bg-gradient-to-b from-zinc-200 pb-6 pt-8 backdrop-blur-2xl dark:border-neutral-800 dark:bg-zinc-800/30 dark:from-inherit lg:static lg:w-auto lg:rounded-xl lg:border lg:bg-gray-200 lg:p-4 lg:dark:bg-zinc-800/30">
|
||||
Get started by editing
|
||||
<code className="font-mono font-bold">app/page.tsx</code>
|
||||
</p>
|
||||
<div className="fixed bottom-0 left-0 flex h-48 w-full items-end justify-center bg-gradient-to-t from-white via-white dark:from-black dark:via-black lg:static lg:size-auto lg:bg-none">
|
||||
<a
|
||||
className="pointer-events-none flex place-items-center gap-2 p-8 lg:pointer-events-auto lg:p-0"
|
||||
href="https://vercel.com?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
By{" "}
|
||||
<Image
|
||||
src="/vercel.svg"
|
||||
alt="Vercel Logo"
|
||||
className="dark:invert"
|
||||
width={100}
|
||||
height={24}
|
||||
priority
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="relative z-[-1] flex place-items-center before:absolute before:h-[300px] before:w-full before:-translate-x-1/2 before:rounded-full before:bg-gradient-radial before:from-white before:to-transparent before:blur-2xl before:content-[''] after:absolute after:-z-20 after:h-[180px] after:w-full after:translate-x-1/3 after:bg-gradient-conic after:from-sky-200 after:via-blue-200 after:blur-2xl after:content-[''] before:dark:bg-gradient-to-br before:dark:from-transparent before:dark:to-blue-700 before:dark:opacity-10 after:dark:from-sky-900 after:dark:via-[#0141ff] after:dark:opacity-40 sm:before:w-[480px] sm:after:w-[240px] before:lg:h-[360px]">
|
||||
<Image
|
||||
className="relative dark:drop-shadow-[0_0_0.3rem_#ffffff70] dark:invert"
|
||||
src="/next.svg"
|
||||
alt="Next.js Logo"
|
||||
width={180}
|
||||
height={37}
|
||||
priority
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mb-32 grid text-center lg:mb-0 lg:w-full lg:max-w-5xl lg:grid-cols-4 lg:text-left">
|
||||
<a
|
||||
href="https://nextjs.org/docs?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className="mb-3 text-2xl font-semibold">
|
||||
Docs{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className="m-0 max-w-[30ch] text-sm opacity-50">
|
||||
Find in-depth information about Next.js features and API.
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://nextjs.org/learn?utm_source=create-next-app&utm_medium=appdir-template-tw&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className="mb-3 text-2xl font-semibold">
|
||||
Learn{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className="m-0 max-w-[30ch] text-sm opacity-50">
|
||||
Learn about Next.js in an interactive course with quizzes!
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/templates?framework=next.js&utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className="mb-3 text-2xl font-semibold">
|
||||
Templates{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className="m-0 max-w-[30ch] text-sm opacity-50">
|
||||
Explore starter templates for Next.js.
|
||||
</p>
|
||||
</a>
|
||||
|
||||
<a
|
||||
href="https://vercel.com/new?utm_source=create-next-app&utm_medium=appdir-template&utm_campaign=create-next-app"
|
||||
className="group rounded-lg border border-transparent px-5 py-4 transition-colors hover:border-gray-300 hover:bg-gray-100 hover:dark:border-neutral-700 hover:dark:bg-neutral-800/30"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<h2 className="mb-3 text-2xl font-semibold">
|
||||
Deploy{" "}
|
||||
<span className="inline-block transition-transform group-hover:translate-x-1 motion-reduce:transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className="m-0 max-w-[30ch] text-balance text-sm opacity-50">
|
||||
Instantly deploy your Next.js site to a shareable URL with Vercel.
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
9
file-share/frontend/nextjs-file-share/next.config.mjs
Normal file
9
file-share/frontend/nextjs-file-share/next.config.mjs
Normal file
@ -0,0 +1,9 @@
|
||||
/** @type {import('next').NextConfig} */
|
||||
const nextConfig = {
|
||||
output: "export",
|
||||
basePath: "/nextjs"
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
|
||||
4807
file-share/frontend/nextjs-file-share/package-lock.json
generated
Normal file
4807
file-share/frontend/nextjs-file-share/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
26
file-share/frontend/nextjs-file-share/package.json
Normal file
26
file-share/frontend/nextjs-file-share/package.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "nextjs-file-share",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "next lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "^18",
|
||||
"react-dom": "^18",
|
||||
"next": "14.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^18",
|
||||
"@types/react-dom": "^18",
|
||||
"postcss": "^8",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"eslint": "^8",
|
||||
"eslint-config-next": "14.2.3"
|
||||
}
|
||||
}
|
||||
3189
file-share/frontend/nextjs-file-share/pnpm-lock.yaml
Normal file
3189
file-share/frontend/nextjs-file-share/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load Diff
8
file-share/frontend/nextjs-file-share/postcss.config.mjs
Normal file
8
file-share/frontend/nextjs-file-share/postcss.config.mjs
Normal file
@ -0,0 +1,8 @@
|
||||
/** @type {import('postcss-load-config').Config} */
|
||||
const config = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
1
file-share/frontend/nextjs-file-share/public/next.svg
Normal file
1
file-share/frontend/nextjs-file-share/public/next.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.3 KiB |
1
file-share/frontend/nextjs-file-share/public/vercel.svg
Normal file
1
file-share/frontend/nextjs-file-share/public/vercel.svg
Normal file
@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
||||
|
After Width: | Height: | Size: 629 B |
20
file-share/frontend/nextjs-file-share/tailwind.config.ts
Normal file
20
file-share/frontend/nextjs-file-share/tailwind.config.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import type { Config } from "tailwindcss";
|
||||
|
||||
const config: Config = {
|
||||
content: [
|
||||
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./components/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
"./app/**/*.{js,ts,jsx,tsx,mdx}",
|
||||
],
|
||||
theme: {
|
||||
extend: {
|
||||
backgroundImage: {
|
||||
"gradient-radial": "radial-gradient(var(--tw-gradient-stops))",
|
||||
"gradient-conic":
|
||||
"conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))",
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
export default config;
|
||||
26
file-share/frontend/nextjs-file-share/tsconfig.json
Normal file
26
file-share/frontend/nextjs-file-share/tsconfig.json
Normal file
@ -0,0 +1,26 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "preserve",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
1
file-share/go/.gitignore
vendored
Normal file
1
file-share/go/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
embeddedfrontend/nextjs
|
||||
17
file-share/go/embeddedfrontend/embeddedfrontend.go
Normal file
17
file-share/go/embeddedfrontend/embeddedfrontend.go
Normal file
@ -0,0 +1,17 @@
|
||||
package embeddedfrontend
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
//go:embed nextjs nextjs/_next*
|
||||
var next embed.FS
|
||||
|
||||
func GetEmbeddedNextJSFrontendHandler() (http.Handler, error) {
|
||||
// dir, err := fs.Sub(next, "nextjs-bin")
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
return http.FileServer(http.FS(next)), nil
|
||||
}
|
||||
8
file-share/go/go.mod
Normal file
8
file-share/go/go.mod
Normal file
@ -0,0 +1,8 @@
|
||||
module github.com/foomo/gotsrpc-mobile-examples/file-share
|
||||
|
||||
go 1.22.2
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
golang.org/x/mobile v0.0.0-20240506190922-a1a533f289d3 // indirect
|
||||
)
|
||||
4
file-share/go/go.sum
Normal file
4
file-share/go/go.sum
Normal file
@ -0,0 +1,4 @@
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
golang.org/x/mobile v0.0.0-20240506190922-a1a533f289d3 h1:lXH7reX0gtet9FgdXR0WDs3t1nt0QTjDLt1rrBQ/Qgs=
|
||||
golang.org/x/mobile v0.0.0-20240506190922-a1a533f289d3/go.mod h1:EiXZlVfUTaAyySFVJb9rsODuiO+WXu8HrUuySb7nYFw=
|
||||
224
file-share/go/mobile/mobile.go
Normal file
224
file-share/go/mobile/mobile.go
Normal file
@ -0,0 +1,224 @@
|
||||
package mobile
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"crypto/ecdsa"
|
||||
"crypto/elliptic"
|
||||
"crypto/rand"
|
||||
"crypto/x509"
|
||||
"crypto/x509/pkix"
|
||||
"encoding/pem"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"net"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/davecgh/go-spew/spew"
|
||||
"github.com/foomo/gotsrpc-mobile-examples/file-share/embeddedfrontend"
|
||||
)
|
||||
|
||||
// derived from : https://raw.githubusercontent.com/golang/go/master/src/crypto/tls/generate_cert.go
|
||||
// https://raw.githubusercontent.com/foomo/webgrapple/main/pkg/server/selfsign.go
|
||||
func selfsign(hosts []string, certFile, keyFile string) error {
|
||||
|
||||
const timeFormat = "Jan 2 15:04:05 2006"
|
||||
var (
|
||||
validFrom = time.Now().Format(timeFormat)
|
||||
validFor = 365 * 24 * time.Hour
|
||||
isCA = false
|
||||
)
|
||||
|
||||
priv, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to generate private key: %w", err)
|
||||
}
|
||||
|
||||
var notBefore time.Time
|
||||
if len(validFrom) == 0 {
|
||||
notBefore = time.Now()
|
||||
} else {
|
||||
notBefore, err = time.Parse(timeFormat, validFrom)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to parse creation date: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
notAfter := notBefore.Add(validFor)
|
||||
|
||||
serialNumberLimit := new(big.Int).Lsh(big.NewInt(1), 128)
|
||||
serialNumber, err := rand.Int(rand.Reader, serialNumberLimit)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to generate serial number: %w", err)
|
||||
}
|
||||
|
||||
template := x509.Certificate{
|
||||
SerialNumber: serialNumber,
|
||||
Subject: pkix.Name{
|
||||
Organization: []string{"Acme Co"},
|
||||
},
|
||||
NotBefore: notBefore,
|
||||
NotAfter: notAfter,
|
||||
|
||||
KeyUsage: x509.KeyUsageDigitalSignature,
|
||||
ExtKeyUsage: []x509.ExtKeyUsage{x509.ExtKeyUsageServerAuth},
|
||||
BasicConstraintsValid: true,
|
||||
}
|
||||
|
||||
for _, h := range hosts {
|
||||
if h == "" {
|
||||
// maybe check for /etc/hosts
|
||||
// log.Fatalf("Missing required --host parameter")
|
||||
}
|
||||
if ip := net.ParseIP(h); ip != nil {
|
||||
template.IPAddresses = append(template.IPAddresses, ip)
|
||||
} else {
|
||||
template.DNSNames = append(template.DNSNames, h)
|
||||
}
|
||||
}
|
||||
|
||||
if isCA {
|
||||
template.IsCA = true
|
||||
template.KeyUsage |= x509.KeyUsageCertSign
|
||||
}
|
||||
|
||||
derBytes, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to create certificate: %w", err)
|
||||
}
|
||||
|
||||
certOut, err := os.Create(certFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to open cert.pem for writing: %w", err)
|
||||
}
|
||||
if err := pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: derBytes}); err != nil {
|
||||
return fmt.Errorf("Failed to write data to cert.pem: %w", err)
|
||||
}
|
||||
if err := certOut.Close(); err != nil {
|
||||
return fmt.Errorf("Error closing cert.pem: %w", err)
|
||||
}
|
||||
|
||||
keyOut, err := os.OpenFile(keyFile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Failed to open key.pem for writing: %w", err)
|
||||
}
|
||||
privBytes, err := x509.MarshalPKCS8PrivateKey(priv)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Unable to marshal private key: %w", err)
|
||||
}
|
||||
if err := pem.Encode(keyOut, &pem.Block{Type: "PRIVATE KEY", Bytes: privBytes}); err != nil {
|
||||
return fmt.Errorf("Failed to write data to key.pem: %w", err)
|
||||
}
|
||||
if err := keyOut.Close(); err != nil {
|
||||
return fmt.Errorf("Error closing key.pem: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// func RunServer(addr string) {
|
||||
// embeddedFrontendHandler, err := embeddedfrontend.GetEmbeddedNextJSFrontendHandler()
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// go func() {
|
||||
// for {
|
||||
// fmt.Println("starting server on addr", addr)
|
||||
// err := http.ListenAndServe(addr, embeddedFrontendHandler)
|
||||
// fmt.Println("-----------> server error", err)
|
||||
// time.Sleep(time.Second)
|
||||
// }
|
||||
// }()
|
||||
// }
|
||||
|
||||
// func RunTLSServer(path, addr string) {
|
||||
// // pinning
|
||||
// // - certificate pinning "... Pinning cannot loosen the trust requirements of your app — it can only tighten them ..."
|
||||
// // - https://developer.apple.com/news/?id=g9ejcf8y
|
||||
// // Creating an Identity for Local Network TLS
|
||||
// // - https://developer.apple.com/documentation/network/creating_an_identity_for_local_network_tls
|
||||
// path = strings.TrimPrefix(path, "file://")
|
||||
// embeddedFrontendHandler, err := embeddedfrontend.GetEmbeddedNextJSFrontendHandler()
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// fmt.Println("creating", path, os.MkdirAll(path, 0777))
|
||||
// certFile, keyFile := filepath.Join(path, "cert.pem"), filepath.Join(path, "key.pem")
|
||||
// fmt.Println("self signinging", selfsign([]string{"localhost"}, certFile, keyFile))
|
||||
// chanCrash := make(chan string)
|
||||
// log, err := os.OpenFile(filepath.Join(path, "go.log"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// go func() {
|
||||
// errs := []string{}
|
||||
// for {
|
||||
|
||||
// select {
|
||||
// case nextErr := <-chanCrash:
|
||||
// errs = append(errs, nextErr)
|
||||
// case <-time.After(10 * time.Second):
|
||||
|
||||
// fmt.Fprintln(log, "all good")
|
||||
// }
|
||||
// fmt.Fprintln(log, "num crashes", len(errs))
|
||||
// for i, err := range errs {
|
||||
// fmt.Fprintln(log, "err", i, err)
|
||||
// }
|
||||
// }
|
||||
// }()
|
||||
// go func() {
|
||||
// fmt.Println("starting server on addr", addr)
|
||||
// err := http.ListenAndServeTLS(addr, certFile, keyFile, embeddedFrontendHandler)
|
||||
// chanCrash <- err.Error()
|
||||
// fmt.Println("-----------> server error", err)
|
||||
// fmt.Fprintln(log, "-----------> server error", err)
|
||||
// time.Sleep(time.Second)
|
||||
// }()
|
||||
// }
|
||||
|
||||
type Server struct {
|
||||
handler http.Handler
|
||||
files []string
|
||||
}
|
||||
|
||||
func NewNextJSHandler(addr string) *Server {
|
||||
embeddedFrontendHandler, err := embeddedfrontend.GetEmbeddedNextJSFrontendHandler()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
s := &Server{
|
||||
handler: embeddedFrontendHandler,
|
||||
}
|
||||
go func() {
|
||||
for {
|
||||
fmt.Println("starting server on addr", addr)
|
||||
err := http.ListenAndServe(addr, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
fmt.Println("serving:", r.URL.Path)
|
||||
switch r.URL.Path {
|
||||
case "/serve":
|
||||
f, err := os.Open(s.files[0])
|
||||
if err != nil {
|
||||
http.Error(w, "file thing:"+err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
defer f.Close()
|
||||
io.Copy(w, f)
|
||||
case "/debug":
|
||||
w.Write([]byte(spew.Sdump(s)))
|
||||
default:
|
||||
embeddedFrontendHandler.ServeHTTP(w, r)
|
||||
}
|
||||
}))
|
||||
fmt.Println("-----------> server error", err)
|
||||
fmt.Println("files", s.files)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
}()
|
||||
return s
|
||||
}
|
||||
|
||||
func (s *Server) ExposeFile(file string) {
|
||||
s.files = append(s.files, file)
|
||||
}
|
||||
2
file-share/ios/.gitignore
vendored
Normal file
2
file-share/ios/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
FileShare/Frameworks/MobileServer.xcframework
|
||||
|
||||
377
file-share/ios/FileShare.xcodeproj/project.pbxproj
Normal file
377
file-share/ios/FileShare.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,377 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 56;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
3D2BD5A72BF25F57000FAED8 /* FileShareApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D2BD5A62BF25F57000FAED8 /* FileShareApp.swift */; };
|
||||
3D2BD5A92BF25F57000FAED8 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D2BD5A82BF25F57000FAED8 /* ContentView.swift */; };
|
||||
3D2BD5AB2BF25F58000FAED8 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D2BD5AA2BF25F58000FAED8 /* Assets.xcassets */; };
|
||||
3D2BD5AE2BF25F58000FAED8 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D2BD5AD2BF25F58000FAED8 /* Preview Assets.xcassets */; };
|
||||
3DBCB9292BF264F500F327FB /* MobileServer.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBCB9282BF264F500F327FB /* MobileServer.xcframework */; };
|
||||
3DBCB92A2BF264F500F327FB /* MobileServer.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBCB9282BF264F500F327FB /* MobileServer.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
3DBCB92B2BF264F500F327FB /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
3DBCB92A2BF264F500F327FB /* MobileServer.xcframework in Embed Frameworks */,
|
||||
);
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
3D2BD5A32BF25F57000FAED8 /* FileShare.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FileShare.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
3D2BD5A62BF25F57000FAED8 /* FileShareApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileShareApp.swift; sourceTree = "<group>"; };
|
||||
3D2BD5A82BF25F57000FAED8 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
|
||||
3D2BD5AA2BF25F58000FAED8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
3D2BD5AD2BF25F58000FAED8 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
|
||||
3DBCB9282BF264F500F327FB /* MobileServer.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = MobileServer.xcframework; path = FileShare/Frameworks/MobileServer.xcframework; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
3D2BD5A02BF25F57000FAED8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3DBCB9292BF264F500F327FB /* MobileServer.xcframework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
3D2BD59A2BF25F57000FAED8 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D2BD5A52BF25F57000FAED8 /* FileShare */,
|
||||
3D2BD5A42BF25F57000FAED8 /* Products */,
|
||||
3DBCB9272BF264F500F327FB /* Frameworks */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D2BD5A42BF25F57000FAED8 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D2BD5A32BF25F57000FAED8 /* FileShare.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D2BD5A52BF25F57000FAED8 /* FileShare */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D2BD5A62BF25F57000FAED8 /* FileShareApp.swift */,
|
||||
3D2BD5A82BF25F57000FAED8 /* ContentView.swift */,
|
||||
3D2BD5AA2BF25F58000FAED8 /* Assets.xcassets */,
|
||||
3D2BD5AC2BF25F58000FAED8 /* Preview Content */,
|
||||
);
|
||||
path = FileShare;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3D2BD5AC2BF25F58000FAED8 /* Preview Content */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3D2BD5AD2BF25F58000FAED8 /* Preview Assets.xcassets */,
|
||||
);
|
||||
path = "Preview Content";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
3DBCB9272BF264F500F327FB /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
3DBCB9282BF264F500F327FB /* MobileServer.xcframework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
3D2BD5A22BF25F57000FAED8 /* FileShare */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 3D2BD5B12BF25F58000FAED8 /* Build configuration list for PBXNativeTarget "FileShare" */;
|
||||
buildPhases = (
|
||||
3D2BD59F2BF25F57000FAED8 /* Sources */,
|
||||
3D2BD5A02BF25F57000FAED8 /* Frameworks */,
|
||||
3D2BD5A12BF25F57000FAED8 /* Resources */,
|
||||
3DBCB92B2BF264F500F327FB /* Embed Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = FileShare;
|
||||
productName = FileShare;
|
||||
productReference = 3D2BD5A32BF25F57000FAED8 /* FileShare.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
3D2BD59B2BF25F57000FAED8 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastSwiftUpdateCheck = 1530;
|
||||
LastUpgradeCheck = 1530;
|
||||
TargetAttributes = {
|
||||
3D2BD5A22BF25F57000FAED8 = {
|
||||
CreatedOnToolsVersion = 15.3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 3D2BD59E2BF25F57000FAED8 /* Build configuration list for PBXProject "FileShare" */;
|
||||
compatibilityVersion = "Xcode 14.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 3D2BD59A2BF25F57000FAED8;
|
||||
productRefGroup = 3D2BD5A42BF25F57000FAED8 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
3D2BD5A22BF25F57000FAED8 /* FileShare */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
3D2BD5A12BF25F57000FAED8 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3D2BD5AE2BF25F58000FAED8 /* Preview Assets.xcassets in Resources */,
|
||||
3D2BD5AB2BF25F58000FAED8 /* Assets.xcassets in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
3D2BD59F2BF25F57000FAED8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
3D2BD5A92BF25F57000FAED8 /* ContentView.swift in Sources */,
|
||||
3D2BD5A72BF25F57000FAED8 /* FileShareApp.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
3D2BD5AF2BF25F58000FAED8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3D2BD5B02BF25F58000FAED8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu17;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 17.4;
|
||||
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
3D2BD5B22BF25F58000FAED8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"FileShare/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = HMQ2Z33C4M;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.foomo.FileShare;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
3D2BD5B32BF25F58000FAED8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"FileShare/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = HMQ2Z33C4M;
|
||||
ENABLE_PREVIEWS = YES;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.foomo.FileShare;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
3D2BD59E2BF25F57000FAED8 /* Build configuration list for PBXProject "FileShare" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3D2BD5AF2BF25F58000FAED8 /* Debug */,
|
||||
3D2BD5B02BF25F58000FAED8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
3D2BD5B12BF25F58000FAED8 /* Build configuration list for PBXNativeTarget "FileShare" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
3D2BD5B22BF25F58000FAED8 /* Debug */,
|
||||
3D2BD5B32BF25F58000FAED8 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 3D2BD59B2BF25F57000FAED8 /* Project object */;
|
||||
}
|
||||
7
file-share/ios/FileShare.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
7
file-share/ios/FileShare.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
||||
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
6
file-share/ios/FileShare/Assets.xcassets/Contents.json
Normal file
6
file-share/ios/FileShare/Assets.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
46
file-share/ios/FileShare/ContentView.swift
Normal file
46
file-share/ios/FileShare/ContentView.swift
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// ContentView.swift
|
||||
// FileShare
|
||||
//
|
||||
// Created by Hans Halfar on 13.05.24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct ContentView: View {
|
||||
@State var isShowing = false
|
||||
var body: some View {
|
||||
VStack {
|
||||
Image(systemName: "globe")
|
||||
.imageScale(.large)
|
||||
.foregroundStyle(.tint)
|
||||
Text("Hello, world!")
|
||||
Button {
|
||||
isShowing.toggle()
|
||||
} label: {
|
||||
Text("select a file")
|
||||
}
|
||||
.fileImporter(isPresented: $isShowing, allowedContentTypes: [.item], allowsMultipleSelection: true, onCompletion: { results in
|
||||
|
||||
switch results {
|
||||
case .success(let fileurls):
|
||||
print(fileurls.count)
|
||||
|
||||
for fileurl in fileurls {
|
||||
print(fileurl.path)
|
||||
server?.exposeFile(fileurl.path)
|
||||
}
|
||||
|
||||
case .failure(let error):
|
||||
print(error)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
ContentView()
|
||||
}
|
||||
23
file-share/ios/FileShare/FileShareApp.swift
Normal file
23
file-share/ios/FileShare/FileShareApp.swift
Normal file
@ -0,0 +1,23 @@
|
||||
//
|
||||
// FileShareApp.swift
|
||||
// FileShare
|
||||
//
|
||||
// Created by Hans Halfar on 13.05.24.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import MobileServer
|
||||
|
||||
public let server = MobileNewNextJSHandler("localhost:3000")
|
||||
|
||||
@main
|
||||
struct FileShareApp: App {
|
||||
var body: some Scene {
|
||||
WindowGroup {
|
||||
ContentView()
|
||||
}
|
||||
}
|
||||
init() {
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
70
file-share/zeus/commands.yml
Normal file
70
file-share/zeus/commands.yml
Normal file
@ -0,0 +1,70 @@
|
||||
# ________ ____ __ __ ______
|
||||
# \___ // __ \| | \/ ___/
|
||||
# / /\ ___/| | /\___ \
|
||||
# /_____ \\___ >____//____ >
|
||||
# \/ \/ \/
|
||||
# Build System
|
||||
# v0.9.14
|
||||
#
|
||||
|
||||
|
||||
|
||||
# default language
|
||||
language: bash
|
||||
|
||||
# globals for all commands
|
||||
globals:
|
||||
|
||||
# command data
|
||||
commands:
|
||||
|
||||
# build the binary
|
||||
build:
|
||||
description: build project
|
||||
dependencies:
|
||||
- clean
|
||||
buildNumber: true
|
||||
exec: |
|
||||
echo "build the binary"
|
||||
|
||||
# clean up the mess
|
||||
clean:
|
||||
description: clean up to prepare for build
|
||||
exec: rm -rf bin/*
|
||||
|
||||
# perform install
|
||||
install:
|
||||
dependencies:
|
||||
- clean
|
||||
description: install to $PATH
|
||||
help: Install the application to the default system location
|
||||
exec: |
|
||||
echo "perform install"
|
||||
|
||||
build-frontend-nextjs:
|
||||
description: static nextjs frontend build for embedding
|
||||
exec: |
|
||||
cd frontend/nextjs-file-share
|
||||
rm -Rvf out
|
||||
pnpm install
|
||||
pnpm build
|
||||
rm -Rvf ../../go/embeddedfrontend/nextjs
|
||||
mv out ../../go/embeddedfrontend/nextjs
|
||||
|
||||
|
||||
gomobile-bind:
|
||||
description: generate ios server framework
|
||||
# dependencies:
|
||||
# - build-frontend-nextjs
|
||||
exec: |
|
||||
cd go
|
||||
go get golang.org/x/mobile/bind/objc
|
||||
go install golang.org/x/mobile/cmd/gomobile@latest
|
||||
gomobile init
|
||||
gomobile bind -v -o ../ios/FileShare/Frameworks/MobileServer.xcframework \
|
||||
-target=ios github.com/foomo/gotsrpc-mobile-examples/file-share/mobile \
|
||||
|| echo "ios bind not working"
|
||||
# gomobile bind -ldflags=-extldflags=-Wl,-soname,libgojni.so -v -target=android/arm \
|
||||
# -o ../GametickerAndroid/app/libs/mobile-server.aar \
|
||||
# github.com/foomo/gotsrpc-mobile-examples/file-share/mobile \
|
||||
# || echo "android bind not working"
|
||||
51
file-share/zeus/config.yml
Executable file
51
file-share/zeus/config.yml
Executable file
@ -0,0 +1,51 @@
|
||||
# ________ ____ __ __ ______
|
||||
# \___ // __ \| | \/ ___/
|
||||
# / /\ ___/| | /\___ \
|
||||
# /_____ \\___ >____//____ >
|
||||
# \/ \/ \/
|
||||
# Build System
|
||||
# v0.9.14
|
||||
#
|
||||
|
||||
autoFormat: false
|
||||
colors: true
|
||||
passCommandsToShell: true
|
||||
webInterface: false
|
||||
interactive: true
|
||||
debug: false
|
||||
projectNamePrompt: true
|
||||
recursionDepth: 1
|
||||
historyLimit: 20
|
||||
codeSnippetScope: 15
|
||||
portWebPanel: 8080
|
||||
portGlueServer: 0
|
||||
historyFile: true
|
||||
exitOnInterrupt: true
|
||||
disableTimestamps: false
|
||||
printBuiltins: false
|
||||
makefileOverview: false
|
||||
stopOnError: true
|
||||
dumpScriptOnError: false
|
||||
quiet: false
|
||||
colorProfile: default
|
||||
dateFormat: 02-01-2006
|
||||
todoFilePath: TODO.md
|
||||
editor: micro
|
||||
colorProfiles:
|
||||
dark:
|
||||
Text: cyan
|
||||
Prompt: blue
|
||||
CmdOutput: white
|
||||
CmdName: blue
|
||||
CmdFields: yellow
|
||||
CmdArgs: white+h
|
||||
CmdArgType: green
|
||||
light:
|
||||
Text: white
|
||||
Prompt: yellow
|
||||
CmdOutput: white+h
|
||||
CmdName: red
|
||||
CmdFields: blue
|
||||
CmdArgs: cyan
|
||||
CmdArgType: green
|
||||
languages: []
|
||||
30
file-share/zeus/data.yml
Executable file
30
file-share/zeus/data.yml
Executable file
@ -0,0 +1,30 @@
|
||||
# ________ ____ __ __ ______
|
||||
# \___ // __ \| | \/ ___/
|
||||
# / /\ ___/| | /\___ \
|
||||
# /_____ \\___ >____//____ >
|
||||
# \/ \/ \/
|
||||
# Build System
|
||||
# v0.9.14
|
||||
#
|
||||
|
||||
buildNumber: 0
|
||||
deadline: ""
|
||||
milestones: []
|
||||
aliases: {}
|
||||
events:
|
||||
cd06a4523ad1b749:
|
||||
name: config watcher
|
||||
id: cd06a4523ad1b749
|
||||
path: zeus/config.yml
|
||||
op: 2
|
||||
fileextension: .yml
|
||||
command: internal
|
||||
e807f399aa2f0805:
|
||||
name: commandsFile watcher
|
||||
id: e807f399aa2f0805
|
||||
path: zeus/commands.yml
|
||||
op: 2
|
||||
fileextension: .yml
|
||||
command: internal
|
||||
author: ""
|
||||
keyBindings: {}
|
||||
Loading…
Reference in New Issue
Block a user