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) {
|
||||
const tab = Cookie.get('tab');
|
||||
if (tab) {
|
||||
const [server, name = null] = tab.split('-');
|
||||
const [server, name = null] = tab.split(/;(.+)/);
|
||||
|
||||
if (find(env.servers, srv => srv.host === server)) {
|
||||
store.dispatch(select(server, name, true));
|
||||
|
@ -16,7 +16,7 @@ class Tab extends TabRecord {
|
||||
toString() {
|
||||
let str = this.server;
|
||||
if (this.name) {
|
||||
str += `-${this.name}`;
|
||||
str += `;${this.name}`;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
@ -119,12 +119,15 @@ func parseTabCookie(r *http.Request, path string) (string, string) {
|
||||
if path == "/" {
|
||||
cookie, err := r.Cookie("tab")
|
||||
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]) {
|
||||
return tab[0], tab[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return "", ""
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user