fix: open the dedicated Reddit Chat host
This commit is contained in:
1 parent
48492d5238
commit
8df2d648dd
5 files changed
+16
-3
No files matched your search
@@ -7,7 +7,7 @@ This local Chrome extension exports `reddit.com` cookies and the current Reddit
|
||||
1. In Chrome, open `chrome://extensions`, enable **Developer mode**, then choose **Load unpacked** and select this folder.
|
||||
If it was already loaded, click its **Reload** button after updating these files so Chrome starts the new service worker.
|
||||
2. Sign in to Reddit in the same Chrome profile.
|
||||
3. Open [Reddit Chat](https://www.reddit.com/chat/) and wait for it to finish loading. The extension badge changes to `OK` when it captures the Matrix credential.
|
||||
3. Open [Reddit Chat](https://chat.reddit.com/) and wait for it to finish loading. Do not use `www.reddit.com/chat/`: its Matrix bridge can return HTTP 405. The extension badge changes to `OK` when it captures the Matrix credential. If no credential has been captured yet, clicking the extension opens the correct Chat host automatically.
|
||||
4. Click the **RedditBot Session Exporter** toolbar icon and save `redditbot-session.json`.
|
||||
5. In RedditBot Dashboard > Settings > Access, choose **Import Reddit session** and select the exported file.
|
||||
6. Delete the downloaded JSON file once the dashboard confirms that the session is authenticated.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"manifest_version": 3,
|
||||
"name": "RedditBot Session Exporter",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"description": "Exports Reddit cookies and Reddit Chat credentials for a self-hosted RedditBot dashboard.",
|
||||
"permissions": ["cookies", "downloads", "storage", "webRequest"],
|
||||
"host_permissions": [
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
assertMatchingSessionIdentity,
|
||||
createSessionExportDownload,
|
||||
REDDIT_CHAT_URL,
|
||||
} from './session-export.js';
|
||||
|
||||
const MATRIX_URLS = [
|
||||
@@ -64,7 +65,13 @@ chrome.action.onClicked.addListener(async () => {
|
||||
const cookies = await chrome.cookies.getAll({ domain: 'reddit.com' });
|
||||
const { matrixCapture } = await chrome.storage.local.get('matrixCapture');
|
||||
if (!matrixCapture) {
|
||||
throw new Error('Open Reddit Chat, wait for it to load, then click the extension again.');
|
||||
await chrome.tabs.create({ url: REDDIT_CHAT_URL });
|
||||
await chrome.action.setBadgeText({ text: '...' });
|
||||
await chrome.action.setBadgeBackgroundColor({ color: '#6c757d' });
|
||||
await chrome.action.setTitle({
|
||||
title: 'Reddit Chat opened. Wait for the badge to show OK, then click again.',
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const whoami = await fetch(`${matrixCapture.homeserver}/_matrix/client/v3/account/whoami`, {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
const REDDITBOT_SESSION_FILENAME = 'redditbot-session.json';
|
||||
export const REDDIT_CHAT_URL = 'https://chat.reddit.com/';
|
||||
|
||||
export function normalizeRedditAccountId(accountId) {
|
||||
const trimmed = String(accountId ?? '').trim();
|
||||
|
||||
Reference in new issue
Block a user