Skip to content

Commit e79a1e4

Browse files
committed
Fix allowed origin config and fix scrolling issue in FE
1 parent a545f2e commit e79a1e4

4 files changed

Lines changed: 13 additions & 5 deletions

File tree

app/core/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,8 @@ class Settings(BaseSettings):
2121
def get_custom_messages(self) -> list[str]:
2222
return self.custom_messages.split(",")
2323

24+
def get_allowed_origins(self) -> list[str]:
25+
return [origin.strip() for origin in self.allowed_origins.split(",")]
26+
2427

2528
settings = Settings() # type: ignore[call-arg]

app/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async def lifespan(app_obj: FastAPI) -> AsyncGenerator[None, None]:
3232

3333
app.add_middleware(
3434
CORSMiddleware,
35-
allow_origins=[settings.allowed_origins],
35+
allow_origins=settings.get_allowed_origins(),
3636
allow_credentials=True,
3737
allow_methods=["*"],
3838
allow_headers=["*"],

frontend/src/components/Manage/ClientCard/TerminalCard.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,15 @@ interface TerminalProps {
99
}
1010

1111
const TerminalCard: React.FC<TerminalProps> = ({ clientName, messages, onClose }) => {
12-
const terminalEndRef = useRef<HTMLDivElement>(null);
12+
const terminalContainerRef = useRef<HTMLDivElement>(null);
1313

1414
useEffect(() => {
15-
terminalEndRef.current?.scrollIntoView({ behavior: 'smooth' });
15+
if (terminalContainerRef.current) {
16+
terminalContainerRef.current.scrollTo({
17+
top: terminalContainerRef.current.scrollHeight,
18+
behavior: 'smooth'
19+
});
20+
}
1621
}, [messages]);
1722

1823
return (
@@ -50,6 +55,7 @@ const TerminalCard: React.FC<TerminalProps> = ({ clientName, messages, onClose }
5055

5156
{/* Terminal Content */}
5257
<Box
58+
ref={terminalContainerRef}
5359
sx={{
5460
flexGrow: 1,
5561
bgcolor: '#1e1e1e',
@@ -87,7 +93,6 @@ const TerminalCard: React.FC<TerminalProps> = ({ clientName, messages, onClose }
8793
{message}
8894
</Box>
8995
))}
90-
<div ref={terminalEndRef} />
9196
</Box>
9297
</>
9398
);

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "backchannelserver"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
description = "BackChannel Server"
55
readme = "README.md"
66
requires-python = ">=3.12"

0 commit comments

Comments
 (0)