A teenager who spat in a woman’s face and threatened to share intimate images of her has narrowly avoided prison.