|
| 1 | +// Sections that moved to pages of their own. A link to one of them, from a page |
| 2 | +// of an earlier release or from another site, is sent on to where it is now. |
| 3 | +export const MOVED_SECTIONS: Record<string, Record<string, string>> = { |
| 4 | + '/guide/client-api': { |
| 5 | + 'peers-and-signaling': '/guide/client/peers', |
| 6 | + 'signaling': '/guide/client/peers#signaling', |
| 7 | + 'polite-and-impolite-peers': '/guide/client/peers#polite-and-impolite-peers', |
| 8 | + 'peer-state': '/guide/client/peers#peer-state', |
| 9 | + 'automatic-ice-recovery': '/guide/client/peers#automatic-ice-recovery', |
| 10 | + 'threads': '/guide/client/threads', |
| 11 | + 'limiting-threads': '/guide/client/threads#limiting-threads', |
| 12 | + 'handlers-on-the-ui-thread': '/guide/client/threads#handlers-on-the-ui-thread', |
| 13 | + 'don-t-wait-in-a-handler': '/guide/client/threads#don-t-wait-in-a-handler', |
| 14 | + 'sending-media': '/guide/client/sending-media', |
| 15 | + 'sending-a-media-file': '/guide/client/sending-media#sending-a-media-file', |
| 16 | + 'pushing-video-and-audio': '/guide/client/sending-media#pushing-video-and-audio', |
| 17 | + 'controlling-senders-and-tracks': '/guide/client/sending-media#controlling-senders-and-tracks', |
| 18 | + 'switching-cameras': '/guide/client/sending-media#switching-cameras', |
| 19 | + 'devices': '/guide/client/sending-media#devices', |
| 20 | + 'receiving-media': '/guide/client/receiving-media', |
| 21 | + 'video-frames': '/guide/client/receiving-media#video-frames', |
| 22 | + 'audio': '/guide/client/receiving-media#audio', |
| 23 | + 'receiving-without-sending': '/guide/client/receiving-media#receiving-without-sending', |
| 24 | + 'recording': '/guide/client/receiving-media#recording', |
| 25 | + 'encoded-transforms': '/guide/client/transforms', |
| 26 | + 'data-channels': '/guide/client/data-channels', |
| 27 | + 'whip-and-whep': '/guide/client/whip-whep', |
| 28 | + 'manual-negotiation': '/guide/client/peers#manual-negotiation', |
| 29 | + 'statistics': '/guide/client/statistics', |
| 30 | + 'diagnosis-and-quality-events': '/guide/client/statistics#diagnosis-and-quality-events', |
| 31 | + 'checking-before-a-call': '/guide/client/statistics#checking-before-a-call', |
| 32 | + }, |
| 33 | + '/guide/get-started': { |
| 34 | + 'using-the-core-api': '/guide/core-api', |
| 35 | + 'initialize-the-webrtc-library': '/guide/core-api#initialize-the-webrtc-library', |
| 36 | + 'create-a-peer-connection': '/guide/core-api#create-a-peer-connection', |
| 37 | + 'signaling': '/guide/core-api#signaling', |
| 38 | + 'letting-the-peer-connection-create-the-description': '/guide/core-api#letting-the-peer-connection-create-the-description', |
| 39 | + 'adding-candidates-and-knowing-the-outcome': '/guide/core-api#adding-candidates-and-knowing-the-outcome', |
| 40 | + 'media-streams': '/guide/core-api#media-streams', |
| 41 | + 'accessing-media-devices': '/guide/core-api#accessing-media-devices', |
| 42 | + 'creating-media-tracks': '/guide/core-api#creating-media-tracks', |
| 43 | + 'adding-tracks-to-peer-connection': '/guide/core-api#adding-tracks-to-peer-connection', |
| 44 | + 'receiving-tracks': '/guide/core-api#receiving-tracks', |
| 45 | + 'cleanup': '/guide/core-api#cleanup', |
| 46 | + 'finding-objects-that-were-never-disposed': '/guide/core-api#finding-objects-that-were-never-disposed', |
| 47 | + }, |
| 48 | +} |
| 49 | + |
| 50 | +// Where the section a path and hash name moved to, relative to the site's base, if it did. |
| 51 | +export function movedSection(path: string, hash: string): string | undefined { |
| 52 | + const page = path.replace(/\.html$/, '').replace(/\/$/, '') |
| 53 | + const anchor = decodeURIComponent(hash.replace(/^#/, '')) |
| 54 | + |
| 55 | + return anchor ? MOVED_SECTIONS[page]?.[anchor] : undefined |
| 56 | +} |
0 commit comments