v0.33.1 9577fee

restart_safety.go RawHistoryFolder

1package cef
2
3import (
4	"errors"
5	"os"
6	"path/filepath"
7)
8
9const (
10	nextStartSafetyMarkerFile = "cef-next-start-safe"
11	safetyMarkerDirPerm       = 0o700
12	safetyMarkerFilePerm      = 0o600
13)
14
15// writeNextStartSafetyMarker records a one-shot recovery request for the next
16// CEF start. The marker lives beside CEF's root cache so it follows explicit
17// per-session cache roots as well as the normal profile.
18func writeNextStartSafetyMarker(stateRoot string) error {
19	if stateRoot == "" {
20		return errors.New("CEF state root is empty")
21	}
22	if err := os.MkdirAll(stateRoot, safetyMarkerDirPerm); err != nil {
23		return err
24	}
25
26	marker := filepath.Join(stateRoot, nextStartSafetyMarkerFile)
27	temporary, err := os.CreateTemp(stateRoot, ".cef-next-start-safe-*")
28	if err != nil {
29		return err
30	}
31	temporaryName := temporary.Name()
32	defer func() { _ = os.Remove(temporaryName) }()
33	if err := temporary.Chmod(safetyMarkerFilePerm); err != nil {
34		_ = temporary.Close()
35		return err
36	}
37	if _, err := temporary.WriteString("safe\n"); err != nil {
38		_ = temporary.Close()
39		return err
40	}
41	if err := temporary.Close(); err != nil {
42		return err
43	}
44	return os.Rename(temporaryName, marker)
45}
46
47// consumeNextStartSafetyMarker consumes a one-shot marker. It deliberately
48// does not follow symlinks, so an untrusted cache entry cannot redirect the
49// recovery check outside the CEF state root.
50func consumeNextStartSafetyMarker(stateRoot string) bool {
51	if stateRoot == "" {
52		return false
53	}
54	marker := filepath.Join(stateRoot, nextStartSafetyMarkerFile)
55	info, err := os.Lstat(marker)
56	if err != nil || !info.Mode().IsRegular() {
57		return false
58	}
59	return os.Remove(marker) == nil
60}
61
62// applyNextStartSafetyEnvironment leaves the Vulkan render stack intact while
63// returning Chromium to its hardware-decode safety defaults for one start.
64func applyNextStartSafetyEnvironment() {
65	_ = os.Setenv(cefEnableVAAPIEnvVar, "0")
66	_ = os.Unsetenv(cefChromiumFlagsEnvVar)
67	_ = os.Unsetenv(cefRenderNodeEnvVar)
68}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close