Skip to content

Commit

Permalink
handling of leading backslash in search and defaults to mastodon.soci…
Browse files Browse the repository at this point in the history
…al instance for trending when using single user masto.host instance
  • Loading branch information
ghobs91 committed Feb 15, 2024
1 parent a969e5e commit 27fa864
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function App() {
id: 'trending',
title: 'Trending',
subtitle: '',
path: `/${instanceURL}/trending`,
path: instance.indexOf('skybridge.fly.dev') > -1 ? `/l/1795987464373403648`: instance.indexOf('masto.host') > -1 ? `/mastodon.social/trending` : `/${instance}/trending`,
icon: 'chart',
},
{
Expand Down Expand Up @@ -293,7 +293,7 @@ function App() {
<Route index element={<Public />} />
<Route path="l" element={<Public local />} />
</Route>
<Route path="/:myCurrentInstance?/trending" element={<Trending />} />
<Route path="/:instance?/trending" element={<Trending />} />
<Route path="/foryou" element={<ForYou />} />
{isLoggedIn && <Route path="/topics" element={<Topics />} />}
<Route path="/:instance?/search" element={<Search />} />
Expand Down
4 changes: 4 additions & 0 deletions src/components/search-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ const SearchForm = forwardRef((props, ref) => {
params.q = replacedString
}
} else {
if (query.indexOf("/" === 0)) {
let replacedString = params.q.replace("/", "");
params.q = replacedString;
}
if (query.indexOf("@") === -1) {
if (query.indexOf("bsky.social") > -1 || query.indexOf("bsky.team") > -1) {
params.q += "@bsky.brid.gy"
Expand Down
2 changes: 1 addition & 1 deletion src/components/timeline.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function Timeline({
id: 'trending',
title: 'Trending',
subtitle: '',
path: instance.indexOf('skybridge.fly.dev') > -1 ? `/l/1795987464373403648` : `/${instance}/trending`,
path: instance.indexOf('skybridge.fly.dev') > -1 ? `/l/1795987464373403648`: instance.indexOf('masto.host') > -1 ? `/mastodon.social/trending` : `/${instance}/trending`,
icon: 'chart',
},
{
Expand Down

0 comments on commit 27fa864

Please sign in to comment.