From 0c4be19805efdf78928dea92c3cfabaf67132d21 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 23 May 2026 02:37:06 +0000 Subject: [PATCH] Revert "Fix ugig profile endpoint (#407)" This reverts commit 4584d2ba6ad2c71e22ac3bcd41f3e890795974d2. --- packages/social/ugig/src/index.test.ts | 28 +------------------------- packages/social/ugig/src/index.ts | 9 ++++----- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/packages/social/ugig/src/index.test.ts b/packages/social/ugig/src/index.test.ts index 6433f9b6..e7c78aef 100644 --- a/packages/social/ugig/src/index.test.ts +++ b/packages/social/ugig/src/index.test.ts @@ -1,30 +1,4 @@ -import { fakeConnectContext, smokeTest } from '@profullstack/sh1pt-core/testing'; -import { afterEach, describe, expect, it, vi } from 'vitest'; +import { smokeTest } from '@profullstack/sh1pt-core/testing'; import adapter from './index.js'; smokeTest(adapter, { idPrefix: 'social' }); - -afterEach(() => { - vi.restoreAllMocks(); -}); - -describe('social-ugig adapter', () => { - it('connects through the current ugig profile endpoint', async () => { - vi.spyOn(globalThis, 'fetch').mockResolvedValue({ - ok: true, - status: 200, - json: async () => ({ profile: { id: 'user-123', username: 'safe_earn_393559' } }), - } as any); - - const ctx = fakeConnectContext({ UGIG_TOKEN: 'test-token' }); - const result = await adapter.connect(ctx as any, {}); - - expect(result.accountId).toBe('safe_earn_393559'); - expect(fetch).toHaveBeenCalledWith( - 'https://ugig.net/api/profile', - expect.objectContaining({ - headers: { Authorization: 'Bearer test-token' }, - }), - ); - }); -}); diff --git a/packages/social/ugig/src/index.ts b/packages/social/ugig/src/index.ts index 9763753c..bb50deb9 100644 --- a/packages/social/ugig/src/index.ts +++ b/packages/social/ugig/src/index.ts @@ -10,7 +10,7 @@ import { defineSocial, oauthSetup } from '@profullstack/sh1pt-core'; // GET /api/gigs — list gigs // POST /api/applications — apply to a gig // POST /api/auth/login — authenticate (email + password) -// GET /api/profile — get authenticated user profile +// GET /api/users/me — get authenticated user profile // // Rate limits: not publicly documented; avoid bursting > ~10 req/min. @@ -34,13 +34,12 @@ export default defineSocial({ const token = ctx.secret('UGIG_TOKEN'); if (!token) throw new Error('UGIG_TOKEN not in vault — see setup()'); - const res = await fetch(`${UGIG_API}/profile`, { + const res = await fetch(`${UGIG_API}/users/me`, { headers: { Authorization: `Bearer ${token}` }, }); if (!res.ok) throw new Error(`ugig auth check failed: HTTP ${res.status}`); - const data = await res.json() as { profile?: { username?: string; id?: string }; username?: string; id?: string }; - const profile = data.profile ?? data; - const username = profile.username ?? config.username ?? 'ugig'; + const data = await res.json() as { username?: string; id?: string }; + const username = data.username ?? config.username ?? 'ugig'; ctx.log(`ugig connected · @${username}`); return { accountId: username }; },