Skip to content

Commit

Permalink
fix: 切换工作区 & 识别 cookie.X-Space-Id
Browse files Browse the repository at this point in the history
  • Loading branch information
hotlong committed Jan 6, 2025
1 parent 17a4875 commit 1ad04b7
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 17 deletions.
4 changes: 3 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ STEEDOS_UNPKG_URL=
STEEDOS_PUBLIC_PAGE_ASSETURLS=

# 允许跨域访问
# STEEDOS_AUTH_COOKIES_USE_SAMESITE=None
STEEDOS_AUTH_COOKIES_USE_SAMESITE=None

# B6_OIDC_ENABLED=true
# B6_OIDC_ISSUER=https://id.steedos.cn/realms/master
Expand All @@ -51,3 +51,5 @@ STEEDOS_PUBLIC_PAGE_ASSETURLS=
# B6_OIDC_NAME=Steedos ID
# B6_OIDC_LABEL=Steedos ID
# B6_OIDC_LOGO=https://www.steedos.com/favicon.png

STEEDOS_TENANT_ENABLE_SAAS=true
7 changes: 4 additions & 3 deletions packages/auth/src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,21 @@ export async function auth(request: Request, response: Response): Promise<any> {
let cookies = new Cookies(request, response);
let authToken: any =
request.headers["x-auth-token"] || (cookies.get("X-Auth-Token") || "").replace(/"/g, "");
let spaceToken = (cookies.get("X-Space-Token") || "").replace(/"/g, "");
let spaceToken = (cookies.get("X-Space-Token") || "").replace(/"/g, "");
let authorization = request.headers.authorization;
let spaceId =
(request.params ? request.params.spaceId : null) ||
(request.query ? request.query.space_id : null) ||
request.headers["x-space-id"];
request.headers["x-space-id"] ||
cookies.get("X-Space-Id");
if (authorization && authorization.split(" ")[0] == "Bearer") {
let spaceAuthToken = authorization.split(" ")[1];
if (isAPIKey(spaceAuthToken)) {
authToken = spaceAuthToken;
} else {
const splitSpaceId = spaceAuthToken.split(",")[0];
const splitAuthtoken = spaceAuthToken.split(",")[1];
if (!spaceId && splitSpaceId) {
if (splitSpaceId) {
spaceId = splitSpaceId;
}
if (splitAuthtoken) {
Expand Down
216 changes: 216 additions & 0 deletions services/service-plugin-amis/public/tailwind/tailwind-steedos.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
position: absolute
}

.relative {
position: relative
}

.sticky {
position: sticky
}
Expand All @@ -75,6 +79,10 @@
left: 0px
}

.isolate {
isolation: isolate
}

.z-20 {
z-index: 20
}
Expand Down Expand Up @@ -170,18 +178,70 @@
display: flex
}

.inline-flex {
display: inline-flex
}

.table {
display: table
}

.inline-table {
display: inline-table
}

.table-caption {
display: table-caption
}

.table-cell {
display: table-cell
}

.table-column {
display: table-column
}

.table-column-group {
display: table-column-group
}

.table-footer-group {
display: table-footer-group
}

.table-header-group {
display: table-header-group
}

.table-row-group {
display: table-row-group
}

.table-row {
display: table-row
}

.flow-root {
display: flow-root
}

.grid {
display: grid
}

.inline-grid {
display: inline-grid
}

.contents {
display: contents
}

.list-item {
display: list-item
}

.hidden {
display: none
}
Expand Down Expand Up @@ -242,10 +302,18 @@
flex-shrink: 0
}

.flex-shrink {
flex-shrink: 1
}

.flex-grow {
flex-grow: 1
}

.border-collapse {
border-collapse: collapse
}

.-translate-x-0 {
--tw-translate-x: -0px;
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
Expand All @@ -255,6 +323,16 @@
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))
}

.select-all {
-webkit-user-select: all;
-moz-user-select: all;
user-select: all
}

.resize {
resize: both
}

.flex-row {
flex-direction: row
}
Expand All @@ -263,6 +341,10 @@
flex-direction: column
}

.flex-wrap {
flex-wrap: wrap
}

.items-center {
align-items: center
}
Expand All @@ -275,6 +357,14 @@
justify-content: space-between
}

.self-start {
align-self: flex-start
}

.self-end {
align-self: flex-end
}

.overflow-auto {
overflow: auto
}
Expand All @@ -295,6 +385,10 @@
white-space: nowrap
}

.break-all {
word-break: break-all
}

.rounded {
border-radius: 0.25rem
}
Expand Down Expand Up @@ -425,6 +519,10 @@
text-align: center
}

.text-justify {
text-align: justify
}

.text-lg {
font-size: 16px
}
Expand All @@ -433,10 +531,62 @@
font-weight: 700
}

.uppercase {
text-transform: uppercase
}

.lowercase {
text-transform: lowercase
}

.capitalize {
text-transform: capitalize
}

.italic {
font-style: italic
}

.ordinal {
--tw-ordinal: ordinal;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.slashed-zero {
--tw-slashed-zero: slashed-zero;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.lining-nums {
--tw-numeric-figure: lining-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.oldstyle-nums {
--tw-numeric-figure: oldstyle-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.proportional-nums {
--tw-numeric-spacing: proportional-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.tabular-nums {
--tw-numeric-spacing: tabular-nums;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.diagonal-fractions {
--tw-numeric-fraction: diagonal-fractions;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.stacked-fractions {
--tw-numeric-fraction: stacked-fractions;
font-variant-numeric: var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)
}

.leading-none {
line-height: 1
}
Expand Down Expand Up @@ -465,6 +615,24 @@
text-decoration-line: underline
}

.overline {
text-decoration-line: overline
}

.line-through {
text-decoration-line: line-through
}

.antialiased {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale
}

.subpixel-antialiased {
-webkit-font-smoothing: auto;
-moz-osx-font-smoothing: auto
}

.shadow-none {
--tw-shadow: 0 0 #0000;
--tw-shadow-colored: 0 0 #0000;
Expand All @@ -477,10 +645,50 @@
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)
}

.outline {
outline-style: solid
}

.ring {
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)
}

.blur {
--tw-blur: blur(8px);
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}

.drop-shadow {
--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / 0.1)) drop-shadow(0 1px 1px rgb(0 0 0 / 0.06));
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}

.grayscale {
--tw-grayscale: grayscale(100%);
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}

.invert {
--tw-invert: invert(100%);
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}

.sepia {
--tw-sepia: sepia(100%);
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}

.filter {
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)
}

.backdrop-filter {
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)
}

.transition {
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
Expand All @@ -497,6 +705,14 @@
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1)
}

.ease-in {
transition-timing-function: cubic-bezier(0.4, 0, 1, 1)
}

.ease-out {
transition-timing-function: cubic-bezier(0, 0, 0.2, 1)
}

.hover\:ml-2\.5:hover {
margin-left: 0.625rem
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><link rel="shortcut icon" href="../../favicon.ico"/><meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="../../manifest.json"/><link rel="stylesheet" href="../../dynamic.css"><script type="text/javascript" src="../../dynamic.js"></script><script src="../../geetest/gt3.js"></script><title>Steedos</title><script defer="defer" src="../../static/js/main.af92f5e1.js"></script><link href="../../static/css/main.5e01c666.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" autocapitalize="off"></div><link rel="stylesheet" href="../../css/main.css"/><div></div></body></html>
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><link rel="shortcut icon" href="../../favicon.ico"/><meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width,shrink-to-fit=no"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="../../manifest.json"/><link rel="stylesheet" href="../../dynamic.css"><script type="text/javascript" src="../../dynamic.js"></script><script src="../../geetest/gt3.js"></script><title>Steedos</title><script defer="defer" src="../../static/js/main.2f753159.js"></script><link href="../../static/css/main.5e01c666.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root" autocapitalize="off"></div><link rel="stylesheet" href="../../css/main.css"/><div></div></body></html>
4 changes: 2 additions & 2 deletions steedos-packages/webapp-accounts/public/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"files": {
"main.css": "../../static/css/main.5e01c666.css",
"main.js": "../../static/js/main.af92f5e1.js",
"main.js": "../../static/js/main.2f753159.js",
"index.html": "../../index.html"
},
"entrypoints": [
"static/css/main.5e01c666.css",
"static/js/main.af92f5e1.js"
"static/js/main.2f753159.js"
]
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function selectSpace(spaceId?: string | null): ActionFunc {
if (!userId)
return {data: false};
let selectedSpaceId = spaceId;
// Client4.setSpaceId(selectedSpaceId);

if (!selectedSpaceId)
selectedSpaceId = LocalStorageStore.getPreviousSpaceId(userId);
Expand Down
Loading

0 comments on commit 1ad04b7

Please sign in to comment.