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)
|
||||
}
|
||||
|
||||
if (service === 'git-receive-pack' && c.req.header('x-sneaker')) {
|
||||
return c.text('Push access denied over sneaker', 403)
|
||||
if (c.req.header('x-sneaker')) {
|
||||
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') {
|
||||
|
|
@ -666,6 +671,10 @@ 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)
|
||||
|
|
|
|||
|
|
@ -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.tool || app.share) && (
|
||||
app.tunnelUrl
|
||||
? <Button onClick={() => { unshareApp(app.name) }}>Unshare</Button>
|
||||
: app.tunnelEnabled
|
||||
|
|
|
|||
|
|
@ -28,10 +28,9 @@ function convert(app: BackendApp): SharedApp {
|
|||
router.sse('/stream', (send) => {
|
||||
let queue = Promise.resolve()
|
||||
const broadcast = () => {
|
||||
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,
|
||||
const apps: SharedApp[] = allApps().map(app => ({
|
||||
...convert(app),
|
||||
logs: app.logs,
|
||||
}))
|
||||
queue = queue.then(() => send(apps))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -158,11 +158,7 @@ export function registerApp(dir: string) {
|
|||
|
||||
const { pkg, error } = loadApp(dir)
|
||||
const state: AppState = error ? 'invalid' : 'stopped'
|
||||
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 })
|
||||
_apps.set(dir, buildApp(dir, pkg, state, error))
|
||||
update()
|
||||
emit({ type: 'app:create', app: dir })
|
||||
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) => {
|
||||
if (app.startupTimer) {
|
||||
clearTimeout(app.startupTimer)
|
||||
|
|
@ -349,11 +354,7 @@ function discoverApps() {
|
|||
for (const dir of allAppDirs()) {
|
||||
const { pkg, error } = loadApp(dir)
|
||||
const state: AppState = error ? 'invalid' : 'stopped'
|
||||
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 })
|
||||
_apps.set(dir, buildApp(dir, pkg, state, error))
|
||||
}
|
||||
update()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ export type App = {
|
|||
tool?: boolean | string
|
||||
apps?: boolean
|
||||
dashboard?: boolean
|
||||
share?: boolean
|
||||
tunnelEnabled?: boolean
|
||||
tunnelUrl?: string
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user