Compare commits
No commits in common. "b410a74d152b8c846ea65604bffc6f4f89a987d3" and "423c9588da716acf468972b8107b5c45a008a348" have entirely different histories.
b410a74d15
...
423c9588da
|
|
@ -641,13 +641,8 @@ 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 (c.req.header('x-sneaker')) {
|
if (service === 'git-receive-pack' && c.req.header('x-sneaker')) {
|
||||||
if (service === 'git-receive-pack') {
|
return c.text('Push access denied over sneaker', 403)
|
||||||
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') {
|
||||||
|
|
@ -671,10 +666,6 @@ 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.share) && (
|
{!app.tool && (
|
||||||
app.tunnelUrl
|
app.tunnelUrl
|
||||||
? <Button onClick={() => { unshareApp(app.name) }}>Unshare</Button>
|
? <Button onClick={() => { unshareApp(app.name) }}>Unshare</Button>
|
||||||
: app.tunnelEnabled
|
: app.tunnelEnabled
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,10 @@ 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(app => ({
|
const apps: SharedApp[] = allApps().map(({
|
||||||
...convert(app),
|
name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl
|
||||||
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,7 +158,11 @@ 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'
|
||||||
_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()
|
update()
|
||||||
emit({ type: 'app:create', app: dir })
|
emit({ type: 'app:create', app: dir })
|
||||||
if (!error) {
|
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) => {
|
const clearTimers = (app: App) => {
|
||||||
if (app.startupTimer) {
|
if (app.startupTimer) {
|
||||||
clearTimeout(app.startupTimer)
|
clearTimeout(app.startupTimer)
|
||||||
|
|
@ -354,7 +349,11 @@ 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'
|
||||||
_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()
|
update()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ 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