正如标题所示,我收到了这封关于我在 Github 上公开的项目的电子邮件。一个是本地企业的登陆页面,另一个是我在 App Store 上的 CRUD 应用程序;两者都使用 Firebase 作为后端。
API 密钥在 Github 上可见是否存在安全风险?在按照电子邮件中的说明限制我的 API 后,我做了一些研究,并听说您无法使用受限的 API 密钥发出 Web 服务请求。
我只是想展示我的应用程序项目的存储库,显然不希望这样做发生任何不好的事情。
Firebase API 不是应该公开的吗?如果是这样,是否只是我的数据库规则需要更强/更详细?
如果需要更多背景信息,请告诉我!
干杯!
注意:我对编程还很陌生,所以很多内容都超出了我的能力范围
google-api firebase google-cloud-functions google-cloud-firestore
我有一个正在使用的基本输入组件,它作为type一个属性,到目前为止一直工作得很好。然而,尝试使用它作为密码并实施混淆有点棘手。
如何在不改变 prop 的情况下切换密码的隐藏/显示?我认为做到这一点type = 'password'是type = 'text最好的方法,但显然不是。
我已经制作了一个Codesandbox来复制组件的该部分,但是任何建议或方向将不胜感激!
密码输入.vue:
<template>
<div>
<input :type="type" />
<button @click="obfuscateToggle" class="ml-auto pl-sm _eye">
<div>
<img :src="`/${eyeSvg}.svg`" alt="" />
</div>
</button>
</div>
</template>
<script>
export default {
name: "HelloWorld",
data() {
return {
passwordVisible: false,
eyeSvg: "eye-closed",
};
},
props: {
type: { type: String, default: "text" },
},
methods: {
obfuscateToggle() {
if (this.eyeSvg === "eye-closed") {
this.eyeSvg = "eye";
} else this.eyeSvg = "eye-closed"; …Run Code Online (Sandbox Code Playgroud) 我正在编写一些基本的 cypress 测试,我只是想确保我们拥有的表具有所有正确的列并且所有数据都正在渲染。
我知道.contains()检查元素选择并允许文本匹配,但此表中可能有各种数据,我只想确保从后端呈现某些内容。
知道如何检查是否有任何(非特定)值吗?
describe('Data Source Table renders properly', () => {
beforeEach(() => {
cy.viewport(1920, 1080)
cy.visit('http://localhost:3000/source')
// Assert we are on the correct page /source
cy.url().should('include', '/source')
})
it('Data Source header exists', () => {
cy.contains('Data Source')
})
it('Data Source table exists, column headers are correct and there is data', () => {
cy.get('table').should('exist')
cy.wait(2000)
cy.get('table').contains('th', 'Ip')
cy.get('table').contains('th', 'Station')
cy.get('table').contains('th', 'Table')
cy.get('table').contains('th', 'Status')
})
})
Run Code Online (Sandbox Code Playgroud) 我正在使用一个包含大量数据输入的仪表板。用户能够编辑任何输入字段数据,我正在尝试测试该功能。
我遇到的麻烦是,如果我有一个函数generateRandomString()可以为我的编辑提供新的单独数据,我如何检查该值是否已正确传递/更新?
使用下面的代码,我无法很好地进行.contains()检查并运行相同的函数,因为它会有所不同。
是否有办法捕获函数生成的任何内容,然后保存它,以便我可以在支票上断言更改.contains()?
任何提示或指示将不胜感激!
干杯!
cy.get('[data-cy=station-form-name]')
.click()
.clear()
.type(generateRandomString())
cy.get('button:contains("Create")').click()
// check if the name has been updated
cy.get('[data-cy=station-details-name]').contains(generateRandomString())
Run Code Online (Sandbox Code Playgroud)