Fix tab cookie
This commit is contained in:
parent
1c199f40e2
commit
f7b80b413e
File diff suppressed because one or more lines are too long
@ -21,7 +21,7 @@ export default function initialState({ store }) {
|
|||||||
if (!store.getState().router.route) {
|
if (!store.getState().router.route) {
|
||||||
const tab = Cookie.get('tab');
|
const tab = Cookie.get('tab');
|
||||||
if (tab) {
|
if (tab) {
|
||||||
const [server, name = null] = tab.split('-');
|
const [server, name = null] = tab.split(/;(.+)/);
|
||||||
|
|
||||||
if (find(env.servers, srv => srv.host === server)) {
|
if (find(env.servers, srv => srv.host === server)) {
|
||||||
store.dispatch(select(server, name, true));
|
store.dispatch(select(server, name, true));
|
||||||
|
@ -16,7 +16,7 @@ class Tab extends TabRecord {
|
|||||||
toString() {
|
toString() {
|
||||||
let str = this.server;
|
let str = this.server;
|
||||||
if (this.name) {
|
if (this.name) {
|
||||||
str += `-${this.name}`;
|
str += `;${this.name}`;
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -119,10 +119,13 @@ func parseTabCookie(r *http.Request, path string) (string, string) {
|
|||||||
if path == "/" {
|
if path == "/" {
|
||||||
cookie, err := r.Cookie("tab")
|
cookie, err := r.Cookie("tab")
|
||||||
if err == nil {
|
if err == nil {
|
||||||
tab := strings.Split(cookie.Value, "-")
|
v, err := url.PathUnescape(cookie.Value)
|
||||||
|
if err == nil {
|
||||||
|
tab := strings.SplitN(v, ";", 2)
|
||||||
|
|
||||||
if len(tab) == 2 && isChannel(tab[1]) {
|
if len(tab) == 2 && isChannel(tab[1]) {
|
||||||
return tab[0], tab[1]
|
return tab[0], tab[1]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user