Compare commits
3 Commits
423c9588da
...
b410a74d15
| Author | SHA1 | Date | |
|---|---|---|---|
| b410a74d15 | |||
| d9533032bc | |||
| e0347444aa |
|
|
@ -641,8 +641,13 @@ app.on('GET', ['/:repo{.+\\.git}/info/refs', '/:repo/info/refs'], async c => {
|
||||||
return c.text('Invalid service', 400)
|
return c.text('Invalid service', 400)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service === 'git-receive-pack' && c.req.header('x-sneaker')) {
|
if (c.req.header('x-sneaker')) {
|
||||||
return c.text('Push access denied over sneaker', 403)
|
if (service === 'git-receive-pack') {
|
||||||
|
return c.text('Push access denied over sneaker', 403)
|
||||||
|
}
|
||||||
|
if (await getVisibility(repoParam) !== 'public') {
|
||||||
|
return c.text('Repository not found', 404)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service === 'git-receive-pack') {
|
if (service === 'git-receive-pack') {
|
||||||
|
|
@ -666,6 +671,10 @@ app.on('POST', ['/:repo{.+\\.git}/git-upload-pack', '/:repo/git-upload-pack'], a
|
||||||
return c.text('Invalid repository name', 400)
|
return c.text('Invalid repository name', 400)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (c.req.header('x-sneaker') && await getVisibility(repoParam) !== 'public') {
|
||||||
|
return c.text('Repository not found', 404)
|
||||||
|
}
|
||||||
|
|
||||||
const bare = repoPath(repoParam)
|
const bare = repoPath(repoParam)
|
||||||
if (!(await dirExists(bare))) {
|
if (!(await dirExists(bare))) {
|
||||||
return c.text('Repository not found', 404)
|
return c.text('Repository not found', 404)
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ export function AppDetail({ app, render }: { app: App, render: () => void }) {
|
||||||
<ClickableAppName onClick={() => openRenameAppModal(app)}>{app.name}</ClickableAppName>
|
<ClickableAppName onClick={() => openRenameAppModal(app)}>{app.name}</ClickableAppName>
|
||||||
</MainTitle>
|
</MainTitle>
|
||||||
<HeaderActions>
|
<HeaderActions>
|
||||||
{!app.tool && (
|
{(!app.tool || app.share) && (
|
||||||
app.tunnelUrl
|
app.tunnelUrl
|
||||||
? <Button onClick={() => { unshareApp(app.name) }}>Unshare</Button>
|
? <Button onClick={() => { unshareApp(app.name) }}>Unshare</Button>
|
||||||
: app.tunnelEnabled
|
: app.tunnelEnabled
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,9 @@ function convert(app: BackendApp): SharedApp {
|
||||||
router.sse('/stream', (send) => {
|
router.sse('/stream', (send) => {
|
||||||
let queue = Promise.resolve()
|
let queue = Promise.resolve()
|
||||||
const broadcast = () => {
|
const broadcast = () => {
|
||||||
const apps: SharedApp[] = allApps().map(({
|
const apps: SharedApp[] = allApps().map(app => ({
|
||||||
name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl
|
...convert(app),
|
||||||
}) => ({
|
logs: app.logs,
|
||||||
name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl,
|
|
||||||
}))
|
}))
|
||||||
queue = queue.then(() => send(apps))
|
queue = queue.then(() => send(apps))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,11 +158,7 @@ export function registerApp(dir: string) {
|
||||||
|
|
||||||
const { pkg, error } = loadApp(dir)
|
const { pkg, error } = loadApp(dir)
|
||||||
const state: AppState = error ? 'invalid' : 'stopped'
|
const state: AppState = error ? 'invalid' : 'stopped'
|
||||||
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
|
_apps.set(dir, buildApp(dir, pkg, state, error))
|
||||||
const tool = pkg.toes?.tool
|
|
||||||
const apps = pkg.toes?.apps
|
|
||||||
const dashboard = pkg.toes?.dashboard
|
|
||||||
_apps.set(dir, { name: dir, state, icon, error, tool, apps, dashboard })
|
|
||||||
update()
|
update()
|
||||||
emit({ type: 'app:create', app: dir })
|
emit({ type: 'app:create', app: dir })
|
||||||
if (!error) {
|
if (!error) {
|
||||||
|
|
@ -301,6 +297,15 @@ export function updateAppIcon(dir: string, icon: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const buildApp = (dir: string, pkg: any, state: AppState, error?: string): App => ({
|
||||||
|
name: dir, state, error,
|
||||||
|
icon: pkg.toes?.icon ?? DEFAULT_EMOJI,
|
||||||
|
tool: pkg.toes?.tool,
|
||||||
|
apps: pkg.toes?.apps,
|
||||||
|
dashboard: pkg.toes?.dashboard,
|
||||||
|
share: pkg.toes?.share,
|
||||||
|
})
|
||||||
|
|
||||||
const clearTimers = (app: App) => {
|
const clearTimers = (app: App) => {
|
||||||
if (app.startupTimer) {
|
if (app.startupTimer) {
|
||||||
clearTimeout(app.startupTimer)
|
clearTimeout(app.startupTimer)
|
||||||
|
|
@ -349,11 +354,7 @@ function discoverApps() {
|
||||||
for (const dir of allAppDirs()) {
|
for (const dir of allAppDirs()) {
|
||||||
const { pkg, error } = loadApp(dir)
|
const { pkg, error } = loadApp(dir)
|
||||||
const state: AppState = error ? 'invalid' : 'stopped'
|
const state: AppState = error ? 'invalid' : 'stopped'
|
||||||
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
|
_apps.set(dir, buildApp(dir, pkg, state, error))
|
||||||
const tool = pkg.toes?.tool
|
|
||||||
const apps = pkg.toes?.apps
|
|
||||||
const dashboard = pkg.toes?.dashboard
|
|
||||||
_apps.set(dir, { name: dir, state, icon, error, tool, apps, dashboard })
|
|
||||||
}
|
}
|
||||||
update()
|
update()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ export type App = {
|
||||||
tool?: boolean | string
|
tool?: boolean | string
|
||||||
apps?: boolean
|
apps?: boolean
|
||||||
dashboard?: boolean
|
dashboard?: boolean
|
||||||
|
share?: boolean
|
||||||
tunnelEnabled?: boolean
|
tunnelEnabled?: boolean
|
||||||
tunnelUrl?: string
|
tunnelUrl?: string
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user