Skip to content

Commit 3985393

Browse files
authored
Strip "oauth:" prefix from ChannelReward functions (#70)
- Mirrors existing behaviour from `pubsubConnect` to strip `oauth:` from channel password. - Updates twitchdemo.html with local comfy.js - Fixes #69.
1 parent 89cd1e0 commit 3985393

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,6 +1345,7 @@ var comfyJS = {
13451345
},
13461346
GetChannelRewards: async function( clientId, manageableOnly = false ) {
13471347
if( channelPassword ) {
1348+
channelPassword = channelPassword.replace( "oauth:", "" );
13481349
if( !channelInfo ) {
13491350
let info = await fetch( `https://api.twitch.tv/helix/users?login=${mainChannel}`, {
13501351
headers: {
@@ -1368,6 +1369,7 @@ var comfyJS = {
13681369
},
13691370
CreateChannelReward: async function( clientId, rewardInfo ) {
13701371
if( channelPassword ) {
1372+
channelPassword = channelPassword.replace( "oauth:", "" );
13711373
if( !channelInfo ) {
13721374
let info = await fetch( `https://api.twitch.tv/helix/users?login=${mainChannel}`, {
13731375
headers: {
@@ -1394,6 +1396,7 @@ var comfyJS = {
13941396
},
13951397
UpdateChannelReward: async function( clientId, rewardId, rewardInfo ) {
13961398
if( channelPassword ) {
1399+
channelPassword = channelPassword.replace( "oauth:", "" );
13971400
if( !channelInfo ) {
13981401
let info = await fetch( `https://api.twitch.tv/helix/users?login=${mainChannel}`, {
13991402
headers: {
@@ -1420,6 +1423,7 @@ var comfyJS = {
14201423
},
14211424
DeleteChannelReward: async function( clientId, rewardId ) {
14221425
if( channelPassword ) {
1426+
channelPassword = channelPassword.replace( "oauth:", "" );
14231427
if( !channelInfo ) {
14241428
let info = await fetch( `https://api.twitch.tv/helix/users?login=${mainChannel}`, {
14251429
headers: {

examples/twitchdemo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<html>
22
<head>
3-
<script src="https://cdn.jsdelivr.net/npm/comfy.js@1.1.6/dist/comfy.min.js"></script>
3+
<script src="../dist/comfy.js"></script>
44
</head>
55
<body>
66
<h1 id="math"></h1>

0 commit comments

Comments
 (0)