Compare commits

..

No commits in common. "b410a74d152b8c846ea65604bffc6f4f89a987d3" and "423c9588da716acf468972b8107b5c45a008a348" have entirely different histories.

5 changed files with 17 additions and 27 deletions

View File

@ -641,14 +641,9 @@ app.on('GET', ['/:repo{.+\\.git}/info/refs', '/:repo/info/refs'], async c => {
return c.text('Invalid service', 400)
}
if (c.req.header('x-sneaker')) {
if (service === 'git-receive-pack') {
if (service === 'git-receive-pack' && c.req.header('x-sneaker')) {
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') {
await ensureBareRepo(repoParam)
@ -671,10 +666,6 @@ app.on('POST', ['/:repo{.+\\.git}/git-upload-pack', '/:repo/git-upload-pack'], a
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)
if (!(await dirExists(bare))) {
return c.text('Repository not found', 404)

View File

@ -64,7 +64,7 @@ export function AppDetail({ app, render }: { app: App, render: () => void }) {
<ClickableAppName onClick={() => openRenameAppModal(app)}>{app.name}</ClickableAppName>
</MainTitle>
<HeaderActions>
{(!app.tool || app.share) && (
{!app.tool && (
app.tunnelUrl
? <Button onClick={() => { unshareApp(app.name) }}>Unshare</Button>
: app.tunnelEnabled

View File

@ -28,9 +28,10 @@ function convert(app: BackendApp): SharedApp {
router.sse('/stream', (send) => {
let queue = Promise.resolve()
const broadcast = () => {
const apps: SharedApp[] = allApps().map(app => ({
...convert(app),
logs: app.logs,
const apps: SharedApp[] = allApps().map(({
name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl
}) => ({
name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl,
}))
queue = queue.then(() => send(apps))
}

View File

@ -158,7 +158,11 @@ export function registerApp(dir: string) {
const { pkg, error } = loadApp(dir)
const state: AppState = error ? 'invalid' : 'stopped'
_apps.set(dir, buildApp(dir, pkg, state, error))
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
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()
emit({ type: 'app:create', app: dir })
if (!error) {
@ -297,15 +301,6 @@ 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) => {
if (app.startupTimer) {
clearTimeout(app.startupTimer)
@ -354,7 +349,11 @@ function discoverApps() {
for (const dir of allAppDirs()) {
const { pkg, error } = loadApp(dir)
const state: AppState = error ? 'invalid' : 'stopped'
_apps.set(dir, buildApp(dir, pkg, state, error))
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
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()
}

View File

@ -31,7 +31,6 @@ export type App = {
tool?: boolean | string
apps?: boolean
dashboard?: boolean
share?: boolean
tunnelEnabled?: boolean
tunnelUrl?: string
}