Fix CSP/caching issue.

pull/1103/head
Rick Carlino 2019-02-04 14:54:17 -06:00
parent 3cebaf939c
commit 347285b659
44 changed files with 46 additions and 42 deletions

View File

@ -28,6 +28,9 @@ class DashboardController < ApplicationController
[:main_app, :front_page, :password_reset, :tos_update].map do |actn|
define_method(actn) do
begin
# If you don't do this, you will hit hard to debug
# CSP errors on local when changing API_HOST.
response.headers["Cache-Control"] = "no-cache, no-store"
load_css_assets
load_js_assets
render actn, layout: "dashboard"

View File

@ -6,7 +6,7 @@ FarmBot::Application.configure do
}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: FarmBot::Application::LOCAL_API_HOST,
address: Rails.application.routes.default_url_options.fetch(:host),
port: 1025
}
config.active_support.deprecation = :log

View File

@ -1,4 +1,4 @@
import * as moment from "moment";
import moment from "moment";
import {
FarmEventWithExecutable
} from "../farm_designer/farm_events/calendar/interfaces";

View File

@ -1,5 +1,5 @@
import { computeBestTime, getStatus, maxDate } from "../reducer_support";
import * as moment from "moment";
import moment from "moment";
import { ConnectionStatus } from "../interfaces";
// RELEVANT:

View File

@ -1,5 +1,5 @@
import { ConnectionStatus } from "./interfaces";
import * as m from "moment";
import m from "moment";
import { isString, max } from "lodash";
export function maxDate(l: m.Moment, r: m.Moment): string {

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { Xyz, LocationName, Dictionary } from "farmbot";
import * as moment from "moment";
import moment from "moment";
import { BotLocationData, BotPosition } from "../../devices/interfaces";
import { trim } from "../../util";
import { t } from "i18next";

View File

@ -3,7 +3,7 @@ import {
} from "../../../__test_support__/fake_state/resources";
import { filterSensorReadings } from "../filter_readings";
import { SensorReadingsState } from "../interfaces";
import * as moment from "moment";
import moment from "moment";
import { Xyz } from "../../../devices/interfaces";
describe("filterSensorReadings()", () => {

View File

@ -5,7 +5,7 @@ import { SensorReadingsProps } from "../interfaces";
import {
fakeSensorReading, fakeSensor
} from "../../../__test_support__/fake_state/resources";
import * as moment from "moment";
import moment from "moment";
describe("<SensorReadings />", () => {
function fakeProps(): SensorReadingsProps {

View File

@ -2,7 +2,7 @@ import { TaggedSensorReading } from "farmbot";
import { SensorReadingsState } from "./interfaces";
import { every, isNumber } from "lodash";
import { Xyz } from "../../devices/interfaces";
import * as moment from "moment";
import moment from "moment";
/** One day in seconds. */
const oneDay = 3600 * 24;

View File

@ -1,5 +1,5 @@
import * as React from "react";
import * as moment from "moment";
import moment from "moment";
import { range, clamp } from "lodash";
import { t } from "i18next";
import { SensorReadingPlotProps } from "./interfaces";

View File

@ -3,7 +3,7 @@ import { SensorReadingsTableProps, TableRowProps } from "./interfaces";
import { t } from "i18next";
import { xyzTableEntry } from "../../logs/components/logs_table";
import { formatLogTime } from "../../logs";
import * as moment from "moment";
import moment from "moment";
enum TableColWidth {
sensor = 125,

View File

@ -1,7 +1,7 @@
import * as React from "react";
import { FBSelect, Row, Col, BlurableInput } from "../../ui";
import { t } from "i18next";
import * as moment from "moment";
import moment from "moment";
import { TaggedSensorReading } from "farmbot";
import { TimePeriodSelectionProps, DateDisplayProps } from "./interfaces";
import { cloneDeep } from "lodash";

View File

@ -1,7 +1,7 @@
import * as React from "react";
import { Row, Col } from "../../../ui/index";
import { t } from "i18next";
import * as moment from "moment";
import moment from "moment";
import { TaggedDevice } from "farmbot";
import { ColWidth } from "../farmbot_os_settings";
import { Content } from "../../../constants";

View File

@ -1,7 +1,7 @@
import {
browserToMQTT, botToMQTT, botToAPI, botToFirmware, browserToAPI
} from "../status_checks";
import * as moment from "moment";
import moment from "moment";
import { ConnectionStatus } from "../../../connectivity/interfaces";
import { betterMerge } from "../../../util";

View File

@ -1,5 +1,5 @@
import { isUndefined } from "lodash";
import * as moment from "moment";
import moment from "moment";
import { StatusRowProps } from "./connectivity_row";
import { ConnectionStatus } from "../../connectivity/interfaces";
import { t } from "i18next";

View File

@ -23,7 +23,7 @@ import { isString, isFunction } from "lodash";
import { repeatOptions } from "../map_state_to_props_add_edit";
import { SpecialStatus, VariableDeclaration } from "farmbot";
import { success, error } from "farmbot-toastr";
import * as moment from "moment";
import moment from "moment";
import { fakeState } from "../../../__test_support__/fake_state";
import { history } from "../../../history";
import {

View File

@ -8,7 +8,7 @@ import {
import {
buildResourceIndex
} from "../../../__test_support__/resource_index_builder";
import * as moment from "moment";
import moment from "moment";
import { countBy } from "lodash";
import { TimeUnit } from "farmbot/dist/resources/api_resources";

View File

@ -1,6 +1,6 @@
import { maybeWarnAboutMissedTasks } from "../util";
import { fakeFarmEvent } from "../../../__test_support__/fake_state/resources";
import * as moment from "moment";
import moment from "moment";
describe("maybeWarnAboutMissedTasks()", () => {
function testWarn(time: string): () => void {

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { t } from "i18next";
import * as moment from "moment";
import moment from "moment";
import { connect } from "react-redux";
import { mapStateToPropsAddEdit, } from "./map_state_to_props_add_edit";
import { init, destroy } from "../../api/crud";

View File

@ -4,7 +4,7 @@ import {
TIME,
fakeFarmEventWithExecutable
} from "../../../../__test_support__/farm_event_calendar_support";
import * as moment from "moment";
import moment from "moment";
describe("calendar", () => {
it("constructs itself with defaults", () => {

View File

@ -1,5 +1,5 @@
import { occurrence } from "../occurrence";
import * as moment from "moment";
import moment from "moment";
import {
TIME,
fakeFarmEventWithExecutable

View File

@ -6,7 +6,7 @@ import {
maxDisplayItems,
gracePeriodSeconds
} from "../scheduler";
import * as moment from "moment";
import moment from "moment";
import { Moment } from "moment";
import { range, padStart } from "lodash";
import { TimeUnit } from "farmbot/dist/resources/api_resources";

View File

@ -1,6 +1,6 @@
import { Dictionary } from "farmbot/dist";
import { CalendarOccurrence, CalendarDay } from "../../interfaces";
import * as moment from "moment";
import moment from "moment";
import { chain, sortBy } from "lodash";
export class Calendar {

View File

@ -1,4 +1,4 @@
import * as moment from "moment";
import moment from "moment";
import { CalendarOccurrence } from "../../interfaces";
import { FarmEventWithExecutable } from "./interfaces";
import { Calendar } from "./index";

View File

@ -1,5 +1,5 @@
import { duration } from "moment";
import * as moment from "moment";
import moment from "moment";
import { Moment, unitOfTime } from "moment";
import { range } from "lodash";
import { NEVER } from "../edit_fe_form";

View File

@ -1,5 +1,5 @@
import * as React from "react";
import * as moment from "moment";
import moment from "moment";
import { t } from "i18next";
import { success, error } from "farmbot-toastr";
import {

View File

@ -6,7 +6,7 @@ import { mapStateToProps } from "./map_state_to_props";
import {
FarmEventProps, CalendarOccurrence, FarmEventState
} from "../interfaces";
import * as moment from "moment";
import moment from "moment";
import { Content } from "../../constants";
import { DesignerNavTabs } from "../panel_header";
import { Link } from "../../link";

View File

@ -1,5 +1,5 @@
import { Everything } from "../../interfaces";
import * as moment from "moment";
import moment from "moment";
import { FarmEventProps } from "../interfaces";
import { joinFarmEventsToExecutable } from "./calendar/selectors";
import { Calendar } from "./calendar/index";

View File

@ -1,6 +1,6 @@
import { AddEditFarmEventProps } from "../interfaces";
import { Everything } from "../../interfaces";
import * as moment from "moment";
import moment from "moment";
import { t } from "i18next";
import { history, getPathArray } from "../../history";
import {

View File

@ -1,5 +1,5 @@
import { TaggedFarmEvent } from "farmbot";
import * as moment from "moment";
import moment from "moment";
/**
* PROBLEMS SOLVED:

View File

@ -12,7 +12,7 @@ import { isUndefined, last } from "lodash";
import { AxisNumberProperty, BotSize } from "./map/interfaces";
import { getBotSize, round } from "./map/util";
import { calcZoomLevel, getZoomLevelIndex, saveZoomLevelIndex } from "./map/zoom";
import * as moment from "moment";
import moment from "moment";
import { DesignerNavTabs } from "./panel_header";
import { setWebAppConfigValue, GetWebAppConfigValue } from "../config_storage/actions";
import { SavedGardenHUD } from "./saved_gardens/saved_gardens";

View File

@ -5,7 +5,7 @@ import { offsetTime } from "../../../farm_events/edit_fe_form";
import {
setWebAppConfigValue, GetWebAppConfigValue
} from "../../../../config_storage/actions";
import * as moment from "moment";
import moment from "moment";
import {
formatDate, formatTime
} from "../../../farm_events/map_state_to_props_add_edit";

View File

@ -5,7 +5,7 @@ import { TaggedImage } from "farmbot";
import { MapImage } from "./map_image";
import { reverse, cloneDeep } from "lodash";
import { GetWebAppConfigValue } from "../../../../config_storage/actions";
import * as moment from "moment";
import moment from "moment";
export interface ImageLayerProps {
visible: boolean;

View File

@ -6,7 +6,7 @@ import {
AxisNumberProperty, TaggedPlant, MapTransformProps
} from "../../interfaces";
import { Plant, DEFAULT_PLANT_RADIUS } from "../../../plant";
import * as moment from "moment";
import moment from "moment";
import { unpackUUID } from "../../../../util";
import { isNumber, isString } from "lodash";
import { CropLiveSearchResult, GardenMapState } from "../../../interfaces";

View File

@ -1,5 +1,5 @@
import * as React from "react";
import * as moment from "moment";
import moment from "moment";
import { transformXY } from "../../util";
import { TaggedSensorReading } from "farmbot";
import { MapTransformProps } from "../../interfaces";

View File

@ -11,7 +11,7 @@ import { FormattedPlantInfo } from "../map_state_to_props";
import { Actions } from "../../../constants";
import { clickButton } from "../../../__test_support__/helpers";
import { history } from "../../../history";
import * as moment from "moment";
import moment from "moment";
describe("<PlantPanel/>", () => {
const info: FormattedPlantInfo = {

View File

@ -1,4 +1,4 @@
import * as moment from "moment";
import moment from "moment";
import { Everything } from "../../interfaces";
import { EditPlantInfoProps } from "../interfaces";
import {

View File

@ -1,6 +1,6 @@
import * as React from "react";
import { t } from "i18next";
import * as moment from "moment";
import moment from "moment";
import { DEFAULT_ICON, cachedCrop, svgToUrl } from "../../open_farm/icons";
import { push } from "../../history";
import { Actions } from "../../constants";

View File

@ -7,7 +7,7 @@ import { FBSelect, DropDownItem, BlurableInput, Row, Col } from "../../ui";
import { PlantOptions } from "../interfaces";
import { PlantStage } from "farmbot";
import { Moment } from "moment";
import * as moment from "moment";
import moment from "moment";
import { Actions } from "../../constants";
import { Link } from "../../link";
import { DesignerPanelContent } from "./designer_panel";

View File

@ -1,5 +1,5 @@
import * as React from "react";
import * as moment from "moment";
import moment from "moment";
import { t } from "i18next";
import { success, error } from "farmbot-toastr";
import { ImageFlipper } from "./image_flipper";

View File

@ -1,5 +1,5 @@
import * as React from "react";
import * as moment from "moment";
import moment from "moment";
import { connect } from "react-redux";
import { Col, Row, Page, ToolTip } from "../ui/index";
import { mapStateToProps } from "./state_to_props";

View File

@ -6,7 +6,7 @@ import { commitBulkEditor, setTimeOffset, setSequence } from "./actions";
import {
BlurableInput, Row, Col, FBSelect, DropDownItem, NULL_CHOICE
} from "../../ui/index";
import * as moment from "moment";
import moment from "moment";
import { t } from "i18next";
import { isString } from "lodash";
import { betterCompact, bail } from "../../util";

View File

@ -14,7 +14,7 @@ import {
} from "../resources/selectors";
import { TaggedRegimen } from "farmbot";
import { duration } from "moment";
import * as moment from "moment";
import moment from "moment";
import { ResourceIndex, UUID, VariableNameSet } from "../resources/interfaces";
import {
randomColor, determineInstalledOsVersion,

View File

@ -12,6 +12,7 @@
"jsx": "react",
"module": "esnext",
"moduleResolution": "node",
"esModuleInterop": true,
"noImplicitAny": true,
"noImplicitThis": true,
"noUnusedLocals": true,