2
0
Эх сурвалжийг харах

Merge branch 'master' into imprv/profile-image-cache

yusuketk 5 жил өмнө
parent
commit
a000fbc5dc

+ 1 - 1
src/client/js/components/SearchTypeahead.jsx

@@ -164,7 +164,7 @@ class SearchTypeahead extends React.Component {
     return (
       <span>
         <UserPicture user={page.lastUpdateUser} size="sm" noLink />
-        <span className="ml-1"><PagePathLabel page={page} /></span>
+        <span className="ml-1 text-break text-wrap"><PagePathLabel page={page} /></span>
         <PageListMeta page={page} />
       </span>
     );

+ 6 - 0
src/client/styles/scss/_search.scss

@@ -32,6 +32,12 @@
   .rbt-menu {
     max-height: none !important;
     margin-top: 3px;
+    @extend .dropdown-menu-right;
+    @extend .dropdown-menu-md-left;
+    @include media-breakpoint-down(sm) {
+      left: auto !important;
+      width: 90vw;
+    }
 
     li a span {
       .page-path {

+ 38 - 33
src/server/crowi/index.js

@@ -203,45 +203,50 @@ Crowi.prototype.setupDatabase = function() {
   return mongoose.connect(mongoUri, { useNewUrlParser: true });
 };
 
-Crowi.prototype.setupSessionConfig = function() {
-  const self = this;
+Crowi.prototype.setupSessionConfig = async function() {
   const session = require('express-session');
   const sessionAge = (1000 * 3600 * 24 * 30);
   const redisUrl = this.env.REDISTOGO_URL || this.env.REDIS_URI || this.env.REDIS_URL || null;
+  const uid = require('uid-safe').sync;
+
+  // generate pre-defined uid for healthcheck
+  const healthcheckUid = uid(24);
+
+  const sessionConfig = {
+    rolling: true,
+    secret: this.env.SECRET_TOKEN || 'this is default session secret',
+    resave: false,
+    saveUninitialized: true,
+    cookie: {
+      maxAge: sessionAge,
+    },
+    genid(req) {
+      // return pre-defined uid when healthcheck
+      if (req.path === '/_api/v3/healthcheck') {
+        return healthcheckUid;
+      }
+      return uid(24);
+    },
+  };
 
-  let sessionConfig;
-
-  return new Promise(((resolve, reject) => {
-    sessionConfig = {
-      rolling: true,
-      secret: self.env.SECRET_TOKEN || 'this is default session secret',
-      resave: false,
-      saveUninitialized: true,
-      cookie: {
-        maxAge: sessionAge,
-      },
-    };
-
-    if (self.env.SESSION_NAME) {
-      sessionConfig.name = self.env.SESSION_NAME;
-    }
+  if (this.env.SESSION_NAME) {
+    sessionConfig.name = this.env.SESSION_NAME;
+  }
 
-    // use Redis for session store
-    if (redisUrl) {
-      const redis = require('redis');
-      const redisClient = redis.createClient({ url: redisUrl });
-      const RedisStore = require('connect-redis')(session);
-      sessionConfig.store = new RedisStore({ client: redisClient });
-    }
-    // use MongoDB for session store
-    else {
-      const MongoStore = require('connect-mongo')(session);
-      sessionConfig.store = new MongoStore({ mongooseConnection: mongoose.connection });
-    }
+  // use Redis for session store
+  if (redisUrl) {
+    const redis = require('redis');
+    const redisClient = redis.createClient({ url: redisUrl });
+    const RedisStore = require('connect-redis')(session);
+    sessionConfig.store = new RedisStore({ client: redisClient });
+  }
+  // use MongoDB for session store
+  else {
+    const MongoStore = require('connect-mongo')(session);
+    sessionConfig.store = new MongoStore({ mongooseConnection: mongoose.connection });
+  }
 
-    self.sessionConfig = sessionConfig;
-    resolve();
-  }));
+  this.sessionConfig = sessionConfig;
 };
 
 Crowi.prototype.setupConfigManager = async function() {