Skip to content

Commit 13eb774

Browse files
committed
fix missing redirects tab
1 parent f4a629e commit 13eb774

File tree

7 files changed

+85
-82
lines changed

7 files changed

+85
-82
lines changed

src-tauri/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ async fn send_request(
341341
pub fn run() {
342342
let cookie_jar = Arc::new(reqwest::cookie::Jar::default());
343343
let client = Client::builder()
344+
.redirect(reqwest::redirect::Policy::none())
344345
.cookie_provider(Arc::clone(&cookie_jar))
345346
.build()
346347
.unwrap();

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"updater": {
4040
"active": true,
4141
"endpoints": [
42-
"https://gist.githubusercontent.com/mohnjiles/546f0f1b3ff1f09808bd563f41a144df/raw/5a8e78fb3e7f11fa308dc11e3a071c54dd4b2ae1/test.json"
42+
"https://github.com/LykosAI/LitePost/releases/latest/download/latest.json"
4343
],
4444
"dialog": true,
4545
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDRDQjA2Q0EwQTQ3QjI3MDQKUldRRUozdWtvR3l3VEVvYTVZa0tKNDFvUHVrd0FJUnZ1MTNsSFVMSkF6aCtaM3JhMTJhOVRqNnUK"

src/components/ResponsePanel.tsx

Lines changed: 43 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,17 @@ export function ResponsePanel({
201201
const [rawResponse, setRawResponse] = useState<string>("")
202202
const { jsonViewer } = useSettings()
203203

204+
// Add debug logging
205+
useEffect(() => {
206+
if (response) {
207+
console.log('Response in ResponsePanel:', {
208+
hasRedirectChain: !!response.redirectChain,
209+
redirectChainLength: response.redirectChain?.length,
210+
fullResponse: response
211+
});
212+
}
213+
}, [response]);
214+
204215
useEffect(() => {
205216
if (response?.body) {
206217
try {
@@ -427,29 +438,43 @@ export function ResponsePanel({
427438
<div className="space-y-3 mb-2">
428439
{response.redirectChain.map((redirect, index) => (
429440
<div key={index} className="relative bg-muted rounded-md p-1.5">
430-
<CopyButton
431-
content={`URL: ${redirect.url}\nStatus: ${redirect.statusText}\n\nHeaders:\n${
432-
Object.entries(redirect.headers)
433-
.map(([key, value]) => `${key}: ${value}`)
434-
.join('\n')
435-
}${
436-
redirect.cookies?.length
437-
? `\n\nCookies:\n${redirect.cookies.join('\n')}`
438-
: ''
439-
}`}
440-
className="absolute right-2 top-2 z-10"
441-
/>
442441
<div className="flex justify-between items-center mb-1.5">
443-
<div className="text-sm font-medium">
444-
{index + 1}. {redirect.url}
445-
</div>
446-
<div className="text-xs text-muted-foreground">
447-
Status: {redirect.statusText}
442+
<div className="flex-1 min-w-0 pr-10">
443+
<div className="text-sm font-medium truncate">
444+
{index + 1}. {redirect.url}
445+
</div>
446+
<div className="text-xs text-muted-foreground mt-0.5">
447+
Status: {redirect.statusText}
448+
</div>
448449
</div>
450+
<CopyButton
451+
content={`URL: ${redirect.url}\nStatus: ${redirect.statusText}\n\nHeaders:\n${
452+
Object.entries(redirect.headers)
453+
.map(([key, value]) => `${key}: ${value}`)
454+
.join('\n')
455+
}${
456+
redirect.cookies?.length
457+
? `\n\nCookies:\n${redirect.cookies.join('\n')}`
458+
: ''
459+
}`}
460+
className="absolute right-2 top-2"
461+
/>
449462
</div>
450463
<SyntaxHighlighter
451464
language="text"
452-
style={oneDark}
465+
style={{
466+
...oneDark,
467+
'pre[class*="language-"]': {
468+
...oneDark['pre[class*="language-"]'],
469+
background: 'transparent',
470+
margin: 0,
471+
padding: 0,
472+
},
473+
'code[class*="language-"]': {
474+
...oneDark['code[class*="language-"]'],
475+
background: 'transparent',
476+
},
477+
}}
453478
customStyle={{
454479
margin: 0,
455480
padding: '0.25rem',

src/components/Titlebar.tsx

Lines changed: 21 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Window } from '@tauri-apps/api/window'
22
import { Button } from './ui/button'
3-
import { X, Minus, Square, Settings, Beaker, FolderOpen } from 'lucide-react'
3+
import { X, Minus, Square } from 'lucide-react'
44
import icon from '../assets/icon_1024.png'
55
import { SettingsPanel } from './SettingsPanel'
66
import { EnvironmentPanel } from './EnvironmentPanel'
@@ -72,58 +72,28 @@ export function TitleBar({ currentRequest, onRequestSelect }: TitleBarProps) {
7272
</div>
7373
)}
7474

75-
<EnvironmentPanel
76-
open={isEnvironmentPanelOpen}
77-
onOpenChange={setIsEnvironmentPanelOpen}
78-
trigger={
79-
renderTooltip("Manage environments",
80-
<Button
81-
variant="ghost"
82-
size="sm"
83-
aria-label="Manage environments"
84-
className="h-10 w-10 rounded-none hover:bg-muted"
85-
>
86-
<Beaker className="h-4 w-4" />
87-
</Button>
88-
)
89-
}
90-
/>
75+
{renderTooltip("Manage environments",
76+
<EnvironmentPanel
77+
open={isEnvironmentPanelOpen}
78+
onOpenChange={setIsEnvironmentPanelOpen}
79+
/>
80+
)}
9181

92-
<SettingsPanel
93-
open={isSettingsPanelOpen}
94-
onOpenChange={setIsSettingsPanelOpen}
95-
trigger={
96-
renderTooltip("Settings",
97-
<Button
98-
variant="ghost"
99-
size="sm"
100-
aria-label="Settings"
101-
className="h-10 w-10 rounded-none hover:bg-muted"
102-
>
103-
<Settings className="h-4 w-4" />
104-
</Button>
105-
)
106-
}
107-
/>
82+
{renderTooltip("Settings",
83+
<SettingsPanel
84+
open={isSettingsPanelOpen}
85+
onOpenChange={setIsSettingsPanelOpen}
86+
/>
87+
)}
10888

109-
<CollectionsPanel
110-
open={isCollectionsPanelOpen}
111-
onOpenChange={setIsCollectionsPanelOpen}
112-
currentRequest={currentRequest}
113-
onRequestSelect={onRequestSelect}
114-
trigger={
115-
renderTooltip("Collections",
116-
<Button
117-
variant="ghost"
118-
size="sm"
119-
aria-label="Collections"
120-
className="h-10 w-10 rounded-none hover:bg-muted"
121-
>
122-
<FolderOpen className="h-4 w-4" />
123-
</Button>
124-
)
125-
}
126-
/>
89+
{renderTooltip("Collections",
90+
<CollectionsPanel
91+
open={isCollectionsPanelOpen}
92+
onOpenChange={setIsCollectionsPanelOpen}
93+
currentRequest={currentRequest}
94+
onRequestSelect={onRequestSelect}
95+
/>
96+
)}
12797

12898
{renderTooltip("Minimize",
12999
<Button
@@ -141,7 +111,6 @@ export function TitleBar({ currentRequest, onRequestSelect }: TitleBarProps) {
141111
<Button
142112
variant="ghost"
143113
size="sm"
144-
aria-label="Maximize"
145114
className="h-10 w-10 rounded-none hover:bg-muted"
146115
onClick={() => appWindow.toggleMaximize()}
147116
>
@@ -153,7 +122,6 @@ export function TitleBar({ currentRequest, onRequestSelect }: TitleBarProps) {
153122
<Button
154123
variant="ghost"
155124
size="sm"
156-
aria-label="Close"
157125
className="h-10 w-10 rounded-none hover:bg-red-500 hover:text-white"
158126
onClick={() => appWindow.close()}
159127
>

src/components/UpdateChecker.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { useEffect, useState, useRef } from 'react';
1+
import { useEffect, useRef } from 'react';
22
import { check, type Update } from '@tauri-apps/plugin-updater';
33
import { relaunch } from '@tauri-apps/plugin-process';
44
import { toast } from 'sonner';
5-
import { Button } from './ui/button';
65
import { Progress } from './ui/progress';
76

87
const toastStyles = {
@@ -48,10 +47,8 @@ export async function checkForUpdatesManually() {
4847
}
4948

5049
async function installUpdateManually(update: Update) {
51-
let isInstalling = false;
5250
let toastId: string | number = '';
5351
try {
54-
isInstalling = true;
5552
let downloaded = 0;
5653
let contentLength = 0;
5754

@@ -89,8 +86,6 @@ async function installUpdateManually(update: Update) {
8986
id: toastId,
9087
...toastStyles,
9188
});
92-
} finally {
93-
isInstalling = false;
9489
}
9590
}
9691

src/hooks/useRequest.ts

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ export function useRequest(onHistoryUpdate: (item: HistoryItem) => void) {
115115

116116
console.log('Sending request with options:', options);
117117
const response = await invoke<ResponseData>('send_request', { options })
118-
console.log('Received response:', response);
118+
console.log('Raw response from Rust:', response);
119119

120120
// Add to history
121121
onHistoryUpdate({
@@ -130,6 +130,13 @@ export function useRequest(onHistoryUpdate: (item: HistoryItem) => void) {
130130
auth: tab.auth
131131
})
132132

133+
// Debug logging for redirect chain
134+
console.log('Redirect chain from Rust:', {
135+
hasRedirectChain: !!response.redirect_chain,
136+
redirectChainLength: response.redirect_chain?.length,
137+
redirectChain: response.redirect_chain
138+
});
139+
133140
const mappedResponse = {
134141
status: response.status,
135142
statusText: response.status_text,
@@ -150,7 +157,11 @@ export function useRequest(onHistoryUpdate: (item: HistoryItem) => void) {
150157
size: response.size
151158
}
152159

153-
console.log('Mapped response:', mappedResponse);
160+
console.log('Mapped response with redirects:', {
161+
hasRedirectChain: !!mappedResponse.redirectChain,
162+
redirectChainLength: mappedResponse.redirectChain?.length,
163+
redirectChain: mappedResponse.redirectChain
164+
});
154165
return mappedResponse
155166
} catch (error) {
156167
console.error('Request error:', error)
@@ -159,7 +170,10 @@ export function useRequest(onHistoryUpdate: (item: HistoryItem) => void) {
159170
statusText: "Error",
160171
headers: {},
161172
body: "",
162-
error: typeof error === 'string' ? error : error instanceof Error ? error.message : "An error occurred"
173+
error: typeof error === 'string' ? error : error instanceof Error ? error.message : "An error occurred",
174+
redirectChain: [],
175+
cookies: [],
176+
is_base64: false
163177
}
164178
}
165179
}

src/types/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface Response {
44
headers: Record<string, string>
55
body: string
66
error?: string
7-
redirectChain?: {
7+
redirectChain: {
88
url: string
99
status: number
1010
statusText: string

0 commit comments

Comments
 (0)