Skip to content

Commit

Permalink
Added token header to GET request
Browse files Browse the repository at this point in the history
  • Loading branch information
jaytmiller committed Nov 11, 2024
1 parent 3e038f6 commit 293bebb
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stsci-announce",
"version": "0.5.0",
"version": "0.6.0",
"description": "A JupyterLab extension.",
"keywords": [
"jupyter",
Expand Down
7 changes: 5 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { IStatusBar } from '@jupyterlab/statusbar';
import { Dialog, showDialog } from '@jupyterlab/apputils';
import { ISettingRegistry } from '@jupyterlab/settingregistry';

import { ServerConnection } from '@jupyterlab/services';

// ===================================================================================

// Use the browser's built-in functionality to quickly and safely escape the string
Expand All @@ -14,7 +16,7 @@ function escapeHtml(html: string): string {
}

function dlog(...args: any[]) {
// console.log(...args);
console.log(...args);
}

function log_and_throw(...args: any[]) {
Expand Down Expand Up @@ -189,10 +191,11 @@ class RefreshAnnouncements {
async updateAnnouncements(url: string, n: number) {
try {
dlog(`Updating announcements from ${url} every ${n} microseconds`);

const serverSettings = ServerConnection.makeSettings();
const response = await fetch(url, {
method: 'GET',
headers: {
'Authorization': 'token ' + serverSettings.token,
'Content-Type': 'application/json',
'Cache-Control': 'no-cache'
},
Expand Down
2 changes: 1 addition & 1 deletion stsci_announce/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is auto-generated by Hatchling. As such, do not:
# - modify
# - track in version control e.g. be sure to add to .gitignore
__version__ = VERSION = '0.5.0'
__version__ = VERSION = '0.6.0'
62 changes: 31 additions & 31 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3601,37 +3601,6 @@ __metadata:
languageName: node
linkType: hard

"stsci-announce@workspace:.":
version: 0.0.0-use.local
resolution: "stsci-announce@workspace:."
dependencies:
"@jupyterlab/application": ^4.0.0
"@jupyterlab/builder": ^4.0.0
"@lumino/widgets": ^2.0.1
"@types/json-schema": ^7.0.11
"@types/lodash": ^4.17.0
"@types/react": ^18.0.26
"@typescript-eslint/eslint-plugin": ^5.55.0
"@typescript-eslint/parser": ^5.55.0
css-loader: ^6.7.1
eslint: ^8.36.0
eslint-config-prettier: ^8.7.0
eslint-plugin-prettier: ^4.2.1
npm-run-all: ^4.1.5
prettier: ^2.8.7
rimraf: ^4.4.1
source-map-loader: ^1.0.2
style-loader: ^3.3.1
stylelint: ^14.9.1
stylelint-config-prettier: ^9.0.4
stylelint-config-recommended: ^8.0.0
stylelint-config-standard: ^26.0.0
stylelint-prettier: ^2.0.0
typescript: ~5.0.2
yjs: ^13.5.40
languageName: unknown
linkType: soft

"nice-try@npm:^1.0.4":
version: 1.0.5
resolution: "nice-try@npm:1.0.5"
Expand Down Expand Up @@ -4742,6 +4711,37 @@ __metadata:
languageName: node
linkType: hard

"stsci-announce@workspace:.":
version: 0.0.0-use.local
resolution: "stsci-announce@workspace:."
dependencies:
"@jupyterlab/application": ^4.0.0
"@jupyterlab/builder": ^4.0.0
"@lumino/widgets": ^2.0.1
"@types/json-schema": ^7.0.11
"@types/lodash": ^4.17.0
"@types/react": ^18.0.26
"@typescript-eslint/eslint-plugin": ^5.55.0
"@typescript-eslint/parser": ^5.55.0
css-loader: ^6.7.1
eslint: ^8.36.0
eslint-config-prettier: ^8.7.0
eslint-plugin-prettier: ^4.2.1
npm-run-all: ^4.1.5
prettier: ^2.8.7
rimraf: ^4.4.1
source-map-loader: ^1.0.2
style-loader: ^3.3.1
stylelint: ^14.9.1
stylelint-config-prettier: ^9.0.4
stylelint-config-recommended: ^8.0.0
stylelint-config-standard: ^26.0.0
stylelint-prettier: ^2.0.0
typescript: ~5.0.2
yjs: ^13.5.40
languageName: unknown
linkType: soft

"style-loader@npm:^3.3.1, style-loader@npm:~3.3.1":
version: 3.3.4
resolution: "style-loader@npm:3.3.4"
Expand Down

0 comments on commit 293bebb

Please sign in to comment.