mirror of
https://github.com/better-auth/better-hub
synced 2026-08-09 12:26:04 +00:00
@@ -9,35 +9,6 @@ import {
|
||||
} from "@/lib/github";
|
||||
import { OrgDetailContent } from "@/components/orgs/org-detail-content";
|
||||
import { UserProfileContent } from "@/components/users/user-profile-content";
|
||||
import { ExternalLink, User } from "lucide-react";
|
||||
|
||||
function UnknownAccountPage({ name }: { name: string }) {
|
||||
const githubUrl = `https://github.com/${encodeURIComponent(name)}`;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center py-20 gap-4 text-center">
|
||||
<div className="w-16 h-16 rounded-full bg-muted flex items-center justify-center">
|
||||
<User className="w-8 h-8 text-muted-foreground/50" />
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-base font-medium">{name}</h1>
|
||||
<p className="text-xs text-muted-foreground/60 mt-1 max-w-[240px]">
|
||||
This account can't be viewed here. It may be a bot,
|
||||
app, or mannequin account.
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
href={githubUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center gap-1.5 text-[11px] font-mono px-3 py-1.5 border border-border text-muted-foreground hover:text-foreground hover:border-border transition-colors"
|
||||
>
|
||||
<ExternalLink className="w-3 h-3" />
|
||||
View on GitHub
|
||||
</a>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default async function OwnerPage({ params }: { params: Promise<{ owner: string }> }) {
|
||||
const { owner } = await params;
|
||||
|
||||
@@ -133,7 +133,7 @@ export function ContributionChart({ data }: { data: ContributionData }) {
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="inline-grid pt-6"
|
||||
className="inline-grid pt-0"
|
||||
style={{ gridTemplateColumns: `auto 1fr` }}
|
||||
>
|
||||
{/* Day labels column */}
|
||||
|
||||
@@ -333,7 +333,7 @@ export function UserProfileContent({
|
||||
|
||||
{/* Language distribution */}
|
||||
{languageDistribution.length > 0 && (
|
||||
<div className="mt-5 pt-5 border-t border-border">
|
||||
<div className="my-5 pt-5 border-t border-border">
|
||||
<h2 className="text-[10px] font-mono text-muted-foreground/40 uppercase tracking-widest mb-3">
|
||||
Languages
|
||||
</h2>
|
||||
|
||||
+21
-11
@@ -1,7 +1,7 @@
|
||||
import { Octokit } from "@octokit/rest";
|
||||
import { headers } from "next/headers";
|
||||
import { cache } from "react";
|
||||
import { $Session, auth, getServerSession } from "./auth";
|
||||
import { $Session, getServerSession } from "./auth";
|
||||
import {
|
||||
claimDueGithubSyncJobs,
|
||||
deleteGithubCacheByPrefix,
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
upsertSharedCacheEntry,
|
||||
} from "./github-sync-store";
|
||||
import { redis } from "./redis";
|
||||
import { all } from "better-all";
|
||||
import { computeContributorScore } from "./contributor-score";
|
||||
import { getCachedAuthorDossier, setCachedAuthorDossier } from "./repo-data-cache";
|
||||
|
||||
@@ -573,8 +572,13 @@ async function fetchUserOrgsFromGitHub(octokit: Octokit, perPage: number) {
|
||||
}
|
||||
|
||||
async function fetchOrgFromGitHub(octokit: Octokit, org: string) {
|
||||
const { data } = await octokit.orgs.get({ org });
|
||||
return data;
|
||||
try {
|
||||
const { data } = await octokit.orgs.get({ org });
|
||||
return data;
|
||||
} catch (error) {
|
||||
// 404
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchOrgReposFromGitHub(
|
||||
@@ -1006,11 +1010,7 @@ async function upsertCacheWithShared<T>(
|
||||
}
|
||||
}
|
||||
|
||||
async function touchCacheWithShared(
|
||||
userId: string,
|
||||
cacheKey: string,
|
||||
cacheType: string,
|
||||
) {
|
||||
async function touchCacheWithShared(userId: string, cacheKey: string, cacheType: string) {
|
||||
await touchGithubCacheEntrySyncedAt(userId, cacheKey);
|
||||
if (isShareableCacheType(cacheType)) {
|
||||
touchSharedCacheEntrySyncedAt(cacheKey).catch(() => {});
|
||||
@@ -1372,7 +1372,11 @@ async function processGitDataSyncJob(
|
||||
rdCached?.etag ?? null,
|
||||
);
|
||||
if (rdRes.notModified) {
|
||||
await touchCacheWithShared(authCtx.userId, rdKey, "repo_readme");
|
||||
await touchCacheWithShared(
|
||||
authCtx.userId,
|
||||
rdKey,
|
||||
"repo_readme",
|
||||
);
|
||||
} else {
|
||||
const rdData = rdRes.data as {
|
||||
content: string;
|
||||
@@ -1737,7 +1741,13 @@ async function readLocalFirstGitData<T>({
|
||||
if (shareable) {
|
||||
const shared = await getSharedCacheEntry<T>(cacheKey);
|
||||
if (shared) {
|
||||
upsertGithubCacheEntry(authCtx.userId, cacheKey, cacheType, shared.data, shared.etag).catch(() => {});
|
||||
upsertGithubCacheEntry(
|
||||
authCtx.userId,
|
||||
cacheKey,
|
||||
cacheType,
|
||||
shared.data,
|
||||
shared.etag,
|
||||
).catch(() => {});
|
||||
await enqueueGitDataSync(authCtx, jobType, cacheKey, jobPayload);
|
||||
return shared.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user