Skip to content

Commit

Permalink
Merge pull request #146 from stanford-oval/wip/no-home-page
Browse files Browse the repository at this point in the history
Remove the home page, go straight to conversation
  • Loading branch information
gcampax committed Feb 26, 2021
2 parents 3e1f50a + aa6b9f3 commit cb215a5
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 69 deletions.
21 changes: 0 additions & 21 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,15 @@
// Author: Giovanni Campagna <gcampagn@cs.stanford.edu>
"use strict";

const os = require('os');
const express = require('express');
const Genie = require('genie-toolkit');

const user = require('../util/user');
const platform = require('../service/platform');

const conversationHandler = require('./conversation');

const router = express.Router();

router.get('/', user.requireLogIn, (req, res, next) => {
Genie.IpAddressUtils.getServerName().then((host) => {
var port = res.app.get('port');

var prefs = platform.getSharedPreferences();
var cloudId = prefs.get('cloud-id');
var authToken = prefs.get('auth-token');

if (host !== os.hostname())
var name = os.hostname() + " (" + host + ")";
res.render('index', { page_title: "Almond - The Open Virtual Assistant",
server: { name: name,
port: port,
initialSetup: authToken === undefined },
cloud: { isConfigured: cloudId !== undefined } });
}).catch(next);
});

router.get('/conversation', user.requireLogIn, (req, res, next) => {
res.render('conversation', { page_title: req._("Almond - Chat") });
});

Expand Down
16 changes: 1 addition & 15 deletions tests/test_website_selenium.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,6 @@ async function login(driver) {
await submit.click();
}

async function testHomepage(driver) {
await driver.get(BASE_URL + '/');

await login(driver);

const title = await driver.wait(
WD.until.elementLocated(WD.By.css('.jumbotron.text-center > h1')),
30000);
await checkAllImages(driver);

assert.strictEqual(await title.getText(), 'It works!');
}

// there is some randomness in what message we pick
const WELCOME_MESSAGES = [
`Hi, what can I do for you?`,
Expand All @@ -131,7 +118,7 @@ const WELCOME_MESSAGES = [
];

async function testMyConversation(driver) {
await driver.get(BASE_URL + '/conversation');
await driver.get(BASE_URL + '/');

await login(driver);

Expand Down Expand Up @@ -164,7 +151,6 @@ async function testMyConversation(driver) {
}

async function main() {
await withSelenium(testHomepage);
await withSelenium(testMyConversation);
}
module.exports = main;
Expand Down
2 changes: 0 additions & 2 deletions tests/website/test_me.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ const { login, startSession } = require('./login');

async function testMyStuff(bob, nobody) {
await assertRedirect(sessionRequest('', 'GET', null, nobody, { followRedirects: false }), '/user/login');

await assertRedirect(sessionRequest('/conversation', 'GET', null, nobody, { followRedirects: false }), '/user/login');
}

async function testMyDevices(bob, nobody) {
Expand Down
27 changes: 0 additions & 27 deletions views/index.pug

This file was deleted.

6 changes: 2 additions & 4 deletions views/navbar.pug
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
ul.nav.navbar-nav
if authenticated
li.hidden-md.hidden-lg
a(class="scroller", href=Config.BASE_URL + "/") Home
li
a(class="scroller", href=Config.BASE_URL + "/") Conversation
//-li
a(class="scroller", href=Config.BASE_URL + "/apps") My Rules
li
a(class="scroller", href=Config.BASE_URL + "/devices") My Skills
li
a(class="scroller", href=Config.BASE_URL + "/conversation") Conversation

ul.nav.navbar-nav.navbar-right
if authenticated
Expand Down

0 comments on commit cb215a5

Please sign in to comment.